32 lines
945 B
Go
32 lines
945 B
Go
/*
|
|
DESCRIPTION:
|
|
Sample of struct to define an entity both in the application and database.
|
|
Uses the base struct from the core package for the standard attributes.
|
|
|
|
The sampel shows a workaround on how to avoid the circle-depency which is a
|
|
common problem when it involves the parent-child relationship. By default,
|
|
the relationship is defined in the child entity, and when the parent entity
|
|
needs to use the child as an attribute (array for example), the circle-depency
|
|
happens.
|
|
|
|
To avoid this problem, the parent will have a case-entity like 'full' entity,
|
|
which embeds the 'base' and the 'child' structs.
|
|
|
|
TODO:
|
|
- replace 'parent' with the name of the package, ie: myentity
|
|
- replace 'Parent' with the name of the entity, ie: MyEntity
|
|
*/
|
|
package parent
|
|
|
|
import (
|
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
|
eb "simrs-vx/internal/domain/main-entities/parent/base"
|
|
)
|
|
|
|
type Parent struct {
|
|
ecore.Main
|
|
eb.Basic
|
|
eb.Default
|
|
eb.Extra
|
|
}
|