models

package
v0.16.42 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2021 License: Apache-2.0 Imports: 6 Imported by: 4

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseController

type BaseController struct {
	Store boltz.CrudStore
}

func (*BaseController) GetStore

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

func (*BaseController) ListWithTx

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

func (*BaseController) PreparedListAssociatedWithTx

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

func (*BaseController) PreparedListIndexedWithTx

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

func (*BaseController) PreparedListWithTx

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

type BaseEntity

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

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) SetId

func (entity *BaseEntity) SetId(id string)

type Entity

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

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
}

type FieldError

type FieldError struct {
	Reason     string
	FieldName  string
	FieldValue interface{}
}

func NewFieldError

func NewFieldError(reason, name string, value interface{}) *FieldError

func (FieldError) Error

func (fe FieldError) Error() string

type ListResultHandler

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

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