Documentation ¶
Overview ¶
Package model - Content managed by Project Forge, see [projectforge.md] for details.
Package model - Content managed by Project Forge, see [projectforge.md] for details.
Package model - Content managed by Project Forge, see [projectforge.md] for details.
Package model - Content managed by Project Forge, see [projectforge.md] for details.
Package model - Content managed by Project Forge, see [projectforge.md] for details.
Package model - Content managed by Project Forge, see [projectforge.md] for details.
Package model - Content managed by Project Forge, see [projectforge.md] for details.
Package model - Content managed by Project Forge, see [projectforge.md] for details.
Package model - Content managed by Project Forge, see [projectforge.md] for details.
Package model - Content managed by Project Forge, see [projectforge.md] for details.
Index ¶
- Variables
- func GetStrings(src field.Fields, tgt []string, vals []any) ([]string, error)
- func GetValues(src field.Fields, tgt []string, vals []any) ([]any, error)
- type Index
- type Indexes
- type Metadata
- type Model
- func (m *Model) AddField(f *field.Field) error
- func (m *Model) AddIndex(i *Index) error
- func (m *Model) AddReference(r *Reference) error
- func (m *Model) AddRelationship(r *Relationship) error
- func (m *Model) ApplicableRelations(key string) Relationships
- func (m *Model) Description() string
- func (m *Model) GetPK(logger util.Logger) []string
- func (m *Model) IsPK(key string, logger util.Logger) bool
- func (m *Model) Name() string
- func (m *Model) OrderedMap(data []any) (*util.OrderedMap[any], error)
- func (m *Model) Path() util.Pkg
- func (m *Model) PathString() string
- func (m *Model) PluralName() string
- func (m *Model) String() string
- type Models
- type Package
- func (p *Package) Add(pkg util.Pkg, m *Model)
- func (p *Package) Get(paths []string) (any, []string)
- func (p *Package) GetModel(key string) *Model
- func (p *Package) GetPkg(key string, createIfMissing bool) *Package
- func (p *Package) Name() string
- func (p *Package) Path() util.Pkg
- func (p *Package) PathString() string
- type Packages
- type Reference
- type References
- type Relationship
- type Relationships
- type Type
Constants ¶
This section is empty.
Variables ¶
var ( TypeEnum = Type{Key: "enum", Title: "Enum", Plural: "Enums", Icon: "list"} TypeStruct = Type{Key: "struct", Title: "Struct", Plural: "Structs", Icon: "struct"} TypeInterface = Type{Key: "interface", Title: "Interface", Plural: "Interfaces", Icon: "list"} TypeUnion = Type{Key: "union", Title: "Union", Plural: "Unions", Icon: "world"} TypeIntersection = Type{Key: "intersection", Title: "Intersection", Plural: "Intersections", Icon: "world"} TypeUnknown = Type{Key: "unknown", Title: "Unknown", Plural: "Unknowns", Icon: "world"} )
var AllModelTypes = []Type{TypeEnum, TypeStruct, TypeInterface, TypeUnion, TypeIntersection, TypeUnknown}
Functions ¶
Types ¶
type Index ¶
type Model ¶
type Model struct { Key string `json:"key"` Pkg util.Pkg `json:"pkg,omitempty"` Type Type `json:"type"` Title string `json:"-"` // override only Plural string `json:"-"` // override only Interfaces []string `json:"interfaces,omitempty"` Fields field.Fields `json:"fields,omitempty"` Indexes Indexes `json:"indexes,omitempty"` Relationships Relationships `json:"relationships,omitempty"` References References `json:"-"` // internal cache Metadata *Metadata `json:"metadata,omitempty"` // contains filtered or unexported fields }
func (*Model) AddReference ¶
func (*Model) AddRelationship ¶
func (m *Model) AddRelationship(r *Relationship) error
func (*Model) ApplicableRelations ¶
func (m *Model) ApplicableRelations(key string) Relationships
func (*Model) Description ¶
func (*Model) OrderedMap ¶
func (*Model) PathString ¶
func (*Model) PluralName ¶
type Package ¶
type Package struct { Key string `json:"key"` Title string `json:"title,omitempty"` Pkg util.Pkg `json:"pkg"` ChildModels Models `json:"childModels,omitempty"` ChildPackages Packages `json:"childPackages,omitempty"` }
func ToModelPackage ¶
func (*Package) PathString ¶
type Reference ¶
type Reference struct { Key string `json:"key"` TargetFields []string `json:"tgtFields"` SourcePkg util.Pkg `json:"sourcePackage"` SourceModel string `json:"sourceModel"` SourceFields []string `json:"srcFields"` // contains filtered or unexported fields }
func ReferenceFromRelation ¶
func ReferenceFromRelation(rel *Relationship, m *Model) *Reference
type References ¶
type References []*Reference
func (References) Get ¶
func (s References) Get(key string) *Reference
type Relationship ¶
type Relationship struct { Key string `json:"key"` SourceFields []string `json:"srcFields"` TargetPkg util.Pkg `json:"tgtPackage"` TargetModel string `json:"tgtModel"` TargetFields []string `json:"tgtFields"` }
func (*Relationship) Path ¶
func (r *Relationship) Path() string
func (*Relationship) String ¶
func (r *Relationship) String() string
type Relationships ¶
type Relationships []*Relationship
func (Relationships) Get ¶
func (s Relationships) Get(key string) *Relationship