modelinfo

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entity

type Entity struct {
	Id             IdUid       `json:"id"`
	Name           string      `json:"name"`
	LastPropertyId IdUid       `json:"lastPropertyId"`
	Properties     []*Property `json:"properties"`
	// contains filtered or unexported fields
}

func CreateEntity

func CreateEntity(model *ModelInfo, id Id, uid Uid) *Entity

func (*Entity) CreateProperty

func (entity *Entity) CreateProperty() (*Property, error)

func (*Entity) FindPropertyByName

func (entity *Entity) FindPropertyByName(name string) (*Property, error)

func (*Entity) FindPropertyByUid

func (entity *Entity) FindPropertyByUid(uid Uid) (*Property, error)

func (*Entity) RemoveProperty

func (entity *Entity) RemoveProperty(property *Property) error

func (*Entity) Validate

func (entity *Entity) Validate() (err error)

performs initial validation of loaded data so that it doesn't have to be checked in each function

type Id

type Id = uint32

type IdUid

type IdUid string

func CreateIdUid

func CreateIdUid(id Id, uid Uid) IdUid

func (*IdUid) Get

func (str *IdUid) Get() (Id, Uid, error)

func (IdUid) GetId

func (str IdUid) GetId() (Id, error)

func (*IdUid) GetUid

func (str *IdUid) GetUid() (Uid, error)

func (*IdUid) Validate

func (str *IdUid) Validate() error

performs initial validation of loaded data so that it doesn't have to be checked in each function

type ModelInfo

type ModelInfo struct {
	Comment      []string  `json:"comment"`
	Entities     []*Entity `json:"entities"`
	LastEntityId IdUid     `json:"lastEntityId"`
	LastIndexId  IdUid     `json:"lastIndexId"`
	//ModelVersion        int
	//Version             int
	RetiredEntityUids   []Uid `json:"retiredEntityUids"`
	RetiredIndexUids    []Uid `json:"retiredIndexUids"`
	RetiredPropertyUids []Uid `json:"retiredPropertyUids"`

	// Model Template
	Package string `json:"-"`
	// contains filtered or unexported fields
}

func LoadOrCreateModel

func LoadOrCreateModel(path string) (model *ModelInfo, err error)

func (*ModelInfo) Close

func (model *ModelInfo) Close() error

Close and unlock model

func (*ModelInfo) CreateEntity

func (model *ModelInfo) CreateEntity() (*Entity, error)

func (*ModelInfo) FindEntityByName

func (model *ModelInfo) FindEntityByName(name string) (*Entity, error)

func (*ModelInfo) FindEntityByUid

func (model *ModelInfo) FindEntityByUid(uid Uid) (*Entity, error)

func (*ModelInfo) Validate

func (model *ModelInfo) Validate() (err error)

performs initial validation of loaded data so that it doesn't have to be checked in each function

func (*ModelInfo) Write

func (model *ModelInfo) Write() error

Write current model data to file

type Property

type Property struct {
	Id      IdUid  `json:"id"`
	Name    string `json:"name"`
	IndexId *IdUid `json:"indexId,omitempty"`
	// contains filtered or unexported fields
}

func CreateProperty

func CreateProperty(entity *Entity, id Id, uid Uid) *Property

func (*Property) CreateIndex

func (property *Property) CreateIndex() error

func (*Property) RemoveIndex

func (property *Property) RemoveIndex() error

func (*Property) Validate

func (property *Property) Validate() error

performs initial validation of loaded data so that it doesn't have to be checked in each function

type Relation

type Relation struct {
	Id   IdUid
	Name string
}

func (*Relation) Validate

func (relation *Relation) Validate() error

performs initial validation of loaded data so that it doesn't have to be checked in each function

type Uid

type Uid = uint64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL