29 lines
815 B
Go
29 lines
815 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 is part of the the workaround sample on how to avoid the
|
|
circle-depency. The child is used to define the relationship for the database.
|
|
|
|
TODO:
|
|
- replace 'child' with the name of the package, ie: myentity
|
|
- replace 'Child' with the name of the entity, ie: MyEntity
|
|
*/
|
|
package child
|
|
|
|
import (
|
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
|
eb "simrs-vx/internal/domain/main-entities/child/base"
|
|
ep "simrs-vx/internal/domain/main-entities/parent"
|
|
)
|
|
|
|
type Child struct {
|
|
ecore.Main
|
|
eb.Basic
|
|
Parent_Id int `json:"parent_id"`
|
|
Pareng ep.Parent `json:"parent" gorm:"foreignKey:Parent_Id;references:Id"`
|
|
eb.Default
|
|
eb.Extra
|
|
}
|