models

package
v0.18.6 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: Apache-2.0 Imports: 10 Imported by: 4

Documentation

Index

Constants

View Source
const (
	ListLimitMax      = 500
	ListOffsetMax     = 100000
	ListLimitDefault  = 10
	ListOffsetDefault = 0
)

Variables

This section is empty.

Functions

func ToApiError added in v0.18.0

func ToApiError(err error) *errorz.ApiError

Types

type BaseEntity

type BaseEntity struct {
	Id        string
	CreatedAt time.Time
	UpdatedAt time.Time
	Tags      map[string]interface{}
	IsSystem  bool
}

func (*BaseEntity) FillCommon

func (entity *BaseEntity) FillCommon(boltEntity boltz.ExtEntity)

func (*BaseEntity) GetCreatedAt

func (entity *BaseEntity) GetCreatedAt() time.Time

func (*BaseEntity) GetId

func (entity *BaseEntity) GetId() string

func (*BaseEntity) GetTags

func (entity *BaseEntity) GetTags() map[string]interface{}

func (*BaseEntity) GetUpdatedAt

func (entity *BaseEntity) GetUpdatedAt() time.Time

func (*BaseEntity) IsSystemEntity added in v0.16.45

func (entity *BaseEntity) IsSystemEntity() bool

func (*BaseEntity) SetId

func (entity *BaseEntity) SetId(id string)

type BaseEntityManager added in v0.18.0

type BaseEntityManager struct {
	Store boltz.CrudStore
}

func (*BaseEntityManager) GetStore added in v0.18.0

func (ctrl *BaseEntityManager) GetStore() boltz.CrudStore

func (*BaseEntityManager) ListWithTx added in v0.18.0

func (ctrl *BaseEntityManager) ListWithTx(tx *bbolt.Tx, queryString string, resultHandler ListResultHandler) error

func (*BaseEntityManager) PreparedListAssociatedWithTx added in v0.18.0

func (ctrl *BaseEntityManager) PreparedListAssociatedWithTx(tx *bbolt.Tx, id, association string, query ast.Query, resultHandler ListResultHandler) error

func (*BaseEntityManager) PreparedListIndexedWithTx added in v0.18.0

func (ctrl *BaseEntityManager) PreparedListIndexedWithTx(tx *bbolt.Tx, cursorProvider ast.SetCursorProvider, query ast.Query, resultHandler ListResultHandler) error

func (*BaseEntityManager) PreparedListWithTx added in v0.18.0

func (ctrl *BaseEntityManager) PreparedListWithTx(tx *bbolt.Tx, query ast.Query, resultHandler ListResultHandler) error

func (*BaseEntityManager) ValidateName added in v0.18.0

func (handler *BaseEntityManager) ValidateName(db boltz.Db, boltEntity Named) error

func (*BaseEntityManager) ValidateNameOnCreate added in v0.18.0

func (handler *BaseEntityManager) ValidateNameOnCreate(ctx boltz.MutateContext, entity interface{}) error

func (*BaseEntityManager) ValidateNameOnUpdate added in v0.18.0

func (ctrl *BaseEntityManager) ValidateNameOnUpdate(ctx boltz.MutateContext, updatedEntity, existingEntity boltz.Entity, checker boltz.FieldChecker) error

type Entity

type Entity interface {
	GetId() string
	SetId(string)
	GetCreatedAt() time.Time
	GetUpdatedAt() time.Time
	GetTags() map[string]interface{}
	IsSystemEntity() bool
}

type EntityListResult

type EntityListResult struct {
	Loader   EntityRetriever
	Entities []Entity
	QueryMetaData
}

func (*EntityListResult) Collect

func (result *EntityListResult) Collect(tx *bbolt.Tx, ids []string, queryMetaData *QueryMetaData) error

func (*EntityListResult) GetEntities

func (result *EntityListResult) GetEntities() []Entity

func (*EntityListResult) GetMetaData

func (result *EntityListResult) GetMetaData() *QueryMetaData

type EntityRetriever

type EntityRetriever interface {
	BaseLoad(id string) (Entity, error)
	BaseLoadInTx(tx *bbolt.Tx, id string) (Entity, error)

	BaseList(query string) (*EntityListResult, error)
	BasePreparedList(query ast.Query) (*EntityListResult, error)
	BasePreparedListAssociated(id string, typeLoader EntityRetriever, query ast.Query) (*EntityListResult, error)

	GetStore() boltz.CrudStore

	// GetEntityTypeId returns a unique id for the entity type. Some entities may share a storage type, such
	// as fabric and edge services, and fabric and edge routers. However, they should have distinct entity type
	// ids, so we can figure out to which controller to route commands
	GetEntityTypeId() string
}

type ListResultHandler

type ListResultHandler func(tx *bbolt.Tx, ids []string, qmd *QueryMetaData) error

type Named added in v0.18.0

type Named interface {
	GetName() string
}

type QueryMetaData

type QueryMetaData struct {
	Count            int64
	Limit            int64
	Offset           int64
	FilterableFields []string
}

Jump to

Keyboard shortcuts

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