59 lines
993 B
Go
59 lines
993 B
Go
package entity
|
|
|
|
import "reflect"
|
|
|
|
type PkStrategy int
|
|
|
|
const (
|
|
_ PkStrategy = iota
|
|
Auto
|
|
Manual
|
|
)
|
|
|
|
type (
|
|
Index struct {
|
|
Name string
|
|
Columns []string
|
|
Unique bool
|
|
}
|
|
InternalTools struct {
|
|
ExtractField FieldExtractor
|
|
SetFieldValue FieldSetter
|
|
NewInstance Instantiator
|
|
Copy Copier
|
|
CompareField FieldComparator
|
|
}
|
|
FieldExtractor func(e any, name string) (any, error)
|
|
FieldSetter func(e any, name string, value any) error
|
|
Instantiator func() any
|
|
Copier func(src any, dst any)
|
|
FieldComparator func(e1, e2 any, name string) bool
|
|
)
|
|
|
|
type D3Entity interface {
|
|
D3Token() MetaToken
|
|
}
|
|
|
|
type MetaToken struct {
|
|
Tools InternalTools
|
|
Tpl any
|
|
TableName string
|
|
Indexes []Index
|
|
}
|
|
|
|
type MetaInfo struct {
|
|
Tpl any
|
|
EntityName Name
|
|
TableName string
|
|
Indexes []Index
|
|
|
|
Relations map[string]Relation
|
|
}
|
|
|
|
type FieldInfo struct {
|
|
Name string
|
|
DBAlias string
|
|
FullDBAlias string
|
|
AssociatedType reflect.Type
|
|
}
|