objectbox-go: github.com/objectbox/objectbox-go/internal/generator/modelinfo Index | Files

package modelinfo

import "github.com/objectbox/objectbox-go/internal/generator/modelinfo"

Index

Package Files

entity.go fileio.go iduid.go model.go property.go relation.go relcycles.go

Constants

const (
    ModelVersion = 5
)

type Entity Uses

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 CreateEntity Uses

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

func (*Entity) CreateProperty Uses

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

func (*Entity) CreateRelation Uses

func (entity *Entity) CreateRelation() (*StandaloneRelation, error)

func (*Entity) FindPropertyByName Uses

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

func (*Entity) FindPropertyByUid Uses

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

func (*Entity) FindRelationByName Uses

func (entity *Entity) FindRelationByName(name string) (*StandaloneRelation, error)

func (*Entity) FindRelationByUid Uses

func (entity *Entity) FindRelationByUid(uid Uid) (*StandaloneRelation, error)

func (*Entity) RemoveProperty Uses

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

func (*Entity) RemoveRelation Uses

func (entity *Entity) RemoveRelation(relation *StandaloneRelation) error

func (*Entity) Validate Uses

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 Uses

type Id = uint32

type IdUid Uses

type IdUid string

func CreateIdUid Uses

func CreateIdUid(id Id, uid Uid) IdUid

func (*IdUid) Get Uses

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

func (IdUid) GetId Uses

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

func (*IdUid) GetUid Uses

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

func (*IdUid) Validate Uses

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 Uses

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 Uses

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

func (*ModelInfo) CheckRelationCycles Uses

func (model *ModelInfo) CheckRelationCycles() error

func (*ModelInfo) Close Uses

func (model *ModelInfo) Close() error

Close and unlock model

func (*ModelInfo) CreateEntity Uses

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

func (*ModelInfo) FindEntityByName Uses

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

func (*ModelInfo) FindEntityByUid Uses

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

func (*ModelInfo) Validate Uses

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 Uses

func (model *ModelInfo) Write() error

Write current model data to file

type Property Uses

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 CreateProperty Uses

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

func (*Property) CreateIndex Uses

func (property *Property) CreateIndex() error

func (*Property) RemoveIndex Uses

func (property *Property) RemoveIndex() error

func (*Property) Validate Uses

func (property *Property) Validate() error

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

type StandaloneRelation Uses

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 Uses

func CreateStandaloneRelation(entity *Entity, id IdUid) *StandaloneRelation

func (*StandaloneRelation) SetTarget Uses

func (relation *StandaloneRelation) SetTarget(entity *Entity)

func (*StandaloneRelation) Validate Uses

func (relation *StandaloneRelation) Validate() error

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

type Uid Uses

type Uid = uint64

Package modelinfo imports 9 packages (graph) and is imported by 1 packages. Updated 2019-08-04. Refresh now. Tools for package owners.