Help us shape the future of Go! Take the 2026 Go Developer Survey

models

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func ToApiError

func ToApiError(err error) *errorz.ApiError

func ToApiErrorWithDefault added in v1.4.0

func ToApiErrorWithDefault(err error, f func(err error) *errorz.ApiError) *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

func (entity *BaseEntity) IsSystemEntity() bool

func (*BaseEntity) SetId

func (entity *BaseEntity) SetId(id string)

func (*BaseEntity) ToBoltBaseExtEntity

func (entity *BaseEntity) ToBoltBaseExtEntity() *boltz.BaseExtEntity

type BaseEntityManager

type BaseEntityManager[E boltz.ExtEntity] struct {
	Store boltz.EntityStore[E]
}

func (*BaseEntityManager[E]) GetListStore

func (ctrl *BaseEntityManager[E]) GetListStore() boltz.Store

func (*BaseEntityManager[E]) GetStore

func (ctrl *BaseEntityManager[E]) GetStore() boltz.EntityStore[E]

func (*BaseEntityManager[E]) ListWithTx

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

func (*BaseEntityManager[E]) PreparedListAssociatedWithTx

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

func (*BaseEntityManager[E]) PreparedListIndexedWithTx

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

func (*BaseEntityManager[E]) PreparedListWithTx

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

func (*BaseEntityManager[E]) ValidateName

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

func (*BaseEntityManager[E]) ValidateNameOnCreate

func (handler *BaseEntityManager[E]) ValidateNameOnCreate(tx *bbolt.Tx, entity interface{}) error

func (*BaseEntityManager[E]) ValidateNameOnUpdate

func (ctrl *BaseEntityManager[E]) 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[T Entity] struct {
	Loader interface {
		BaseLoadInTx(tx *bbolt.Tx, id string) (T, error)
	}
	Entities []T
	QueryMetaData
}

func (*EntityListResult[T]) Collect

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

func (*EntityListResult[T]) GetEntities

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

func (*EntityListResult[T]) GetMetaData

func (result *EntityListResult[T]) GetMetaData() *QueryMetaData

type EntityRetriever

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

	BaseList(query string) (*EntityListResult[T], error)
	BasePreparedList(query ast.Query) (*EntityListResult[T], error)

	ListWithHandler(query string, handler ListResultHandler) error
	PreparedListWithHandler(query ast.Query, handler ListResultHandler) error

	PreparedListAssociatedWithHandler(id string, association string, query ast.Query, handler ListResultHandler) error

	GetListStore() boltz.Store

	// 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

	IsEntityPresent(id string) (bool, error)
}

type ListResultHandler

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

type NameIndexedStore

type NameIndexedStore interface {
	boltz.Store
	GetNameIndex() boltz.ReadIndex
}

type Named

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