Documentation
¶
Index ¶
- Constants
- type Entity
- func (entity *Entity) CreateProperty() (*Property, error)
- func (entity *Entity) CreateRelation() (*StandaloneRelation, error)
- func (entity *Entity) FindPropertyByName(name string) (*Property, error)
- func (entity *Entity) FindPropertyByUid(uid Uid) (*Property, error)
- func (entity *Entity) FindRelationByName(name string) (*StandaloneRelation, error)
- func (entity *Entity) FindRelationByUid(uid Uid) (*StandaloneRelation, error)
- func (entity *Entity) RemoveProperty(property *Property) error
- func (entity *Entity) RemoveRelation(relation *StandaloneRelation) error
- func (entity *Entity) Validate() (err error)
- type Id
- type IdUid
- type ModelInfo
- func (model *ModelInfo) CheckRelationCycles() error
- func (model *ModelInfo) Close() error
- func (model *ModelInfo) CreateEntity(name string) (*Entity, error)
- func (model *ModelInfo) FindEntityByName(name string) (*Entity, error)
- func (model *ModelInfo) FindEntityByUid(uid Uid) (*Entity, error)
- func (model *ModelInfo) Validate() (err error)
- func (model *ModelInfo) Write() error
- type Property
- type StandaloneRelation
- type Uid
Constants ¶
View Source
const (
ModelVersion = 5
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entity ¶
type Entity struct {
Id IdUid `json:"id"`
LastPropertyId IdUid `json:"lastPropertyId"`
Name string `json:"name"`
Properties []*Property `json:"properties"`
Relations []*StandaloneRelation `json:"relations,omitempty"`
// contains filtered or unexported fields
}
func (*Entity) CreateProperty ¶
func (*Entity) CreateRelation ¶ added in v0.9.0
func (entity *Entity) CreateRelation() (*StandaloneRelation, error)
func (*Entity) FindPropertyByName ¶
func (*Entity) FindPropertyByUid ¶
func (*Entity) FindRelationByName ¶ added in v0.9.0
func (entity *Entity) FindRelationByName(name string) (*StandaloneRelation, error)
func (*Entity) FindRelationByUid ¶ added in v0.9.0
func (entity *Entity) FindRelationByUid(uid Uid) (*StandaloneRelation, error)
func (*Entity) RemoveProperty ¶
func (*Entity) RemoveRelation ¶ added in v0.9.0
func (entity *Entity) RemoveRelation(relation *StandaloneRelation) error
type ModelInfo ¶
type ModelInfo struct {
// NOTE don't change order of these json exported properties because it will change users' model.json files
Note1 string `json:"_note1"`
Note2 string `json:"_note2"`
Note3 string `json:"_note3"`
Entities []*Entity `json:"entities"`
LastEntityId IdUid `json:"lastEntityId"`
LastIndexId IdUid `json:"lastIndexId"`
LastRelationId IdUid `json:"lastRelationId"`
ModelVersion int `json:"modelVersion"`
MinimumParserVersion int `json:"modelVersionParserMinimum"`
RetiredEntityUids []Uid `json:"retiredEntityUids"`
RetiredIndexUids []Uid `json:"retiredIndexUids"`
RetiredPropertyUids []Uid `json:"retiredPropertyUids"`
RetiredRelationUids []Uid `json:"retiredRelationUids"`
Version int `json:"version"` // user specified version
Rand *rand.Rand `json:"-"` // seeded random number generator
// Model Template
Package string `json:"-"`
// contains filtered or unexported fields
}
func LoadOrCreateModel ¶
func (*ModelInfo) CheckRelationCycles ¶ added in v0.9.0
func (*ModelInfo) FindEntityByName ¶
func (*ModelInfo) FindEntityByUid ¶
type Property ¶
type Property struct {
Id IdUid `json:"id"`
Name string `json:"name"`
IndexId *IdUid `json:"indexId,omitempty"`
Type int `json:"type"`
Flags int `json:"flags,omitempty"`
RelationTarget string `json:"relationTarget,omitempty"`
// contains filtered or unexported fields
}
func (*Property) CreateIndex ¶
func (*Property) RemoveIndex ¶
type StandaloneRelation ¶ added in v0.9.0
type StandaloneRelation struct {
Id IdUid `json:"id"`
Name string `json:"name"`
Target *Entity `json:"-"`
TargetId IdUid `json:"targetId"`
// contains filtered or unexported fields
}
func CreateStandaloneRelation ¶ added in v0.9.0
func CreateStandaloneRelation(entity *Entity, id IdUid) *StandaloneRelation
func (*StandaloneRelation) SetTarget ¶ added in v1.0.0
func (relation *StandaloneRelation) SetTarget(entity *Entity)
func (*StandaloneRelation) Validate ¶ added in v0.9.0
func (relation *StandaloneRelation) Validate() error
performs initial validation of loaded data so that it doesn't have to be checked in each function
Click to show internal directories.
Click to hide internal directories.