Documentation ¶
Overview ¶
Package objectbox provides a super-fast, light-weight object persistence framework.
You can define your entity as a standard .go struct, with a comment signalling to generate ObjectBox code
//go:generate go run github.com/objectbox/objectbox-go/cmd/objectbox-gogen type Person struct { Id uint64 `objectbox:"id"` FirstName string LastName string }
Now, just init ObjectBox using the generated code (don't forget to errors in your real code, they are discarded here to keep the example concise)
ob, _ := objectbox.NewBuilder().Model(ObjectBoxModel()).Build() defer ob.Close() box := BoxForPerson(ob) // Create id, _ := box.Put(&Person{ FirstName: "Joe", LastName: "Green", }) // Read person, _ := box.Get(id) // Update person.LastName = "Black" box.Put(person) // Delete box.Remove(person)
To learn more, see https://golang.objectbox.io/
Index ¶
- Constants
- func Alias(value string) *alias
- func NanoTimeInt64ConvertToDatabaseValue(goValue time.Time) (int64, error)
- func NanoTimeInt64ConvertToEntityProperty(dbValue int64) (time.Time, error)
- func StringIdConvertToDatabaseValue(goValue string) (uint64, error)
- func StringIdConvertToEntityProperty(dbValue uint64) (string, error)
- func SyncIsAvailable() bool
- func TimeBinaryConvertToDatabaseValue(goValue time.Time) ([]byte, error)
- func TimeBinaryConvertToEntityProperty(dbValue []byte) (goValue time.Time, err error)
- func TimeInt64ConvertToDatabaseValue(goValue time.Time) (int64, error)
- func TimeInt64ConvertToEntityProperty(dbValue int64) (time.Time, error)
- func TimeTextConvertToDatabaseValue(goValue time.Time) (string, error)
- func TimeTextConvertToEntityProperty(dbValue string) (goValue time.Time, err error)
- func VersionInfo() string
- type AsyncBox
- func (async *AsyncBox) AwaitCompletion() error
- func (async *AsyncBox) AwaitSubmitted() error
- func (async *AsyncBox) Close() error
- func (async *AsyncBox) Insert(object interface{}) (id uint64, err error)
- func (async *AsyncBox) Put(object interface{}) (id uint64, err error)
- func (async *AsyncBox) Remove(object interface{}) error
- func (async *AsyncBox) RemoveId(id uint64) error
- func (async *AsyncBox) Update(object interface{}) error
- type BaseProperty
- type Box
- func (box *Box) Async() *AsyncBox
- func (box *Box) Contains(id uint64) (bool, error)
- func (box *Box) ContainsIds(ids ...uint64) (bool, error)
- func (box *Box) Count() (uint64, error)
- func (box *Box) CountMax(limit uint64) (uint64, error)
- func (box *Box) Get(id uint64) (object interface{}, err error)
- func (box *Box) GetAll() (slice interface{}, err error)
- func (box *Box) GetMany(ids ...uint64) (slice interface{}, err error)
- func (box *Box) GetManyExisting(ids ...uint64) (slice interface{}, err error)
- func (box *Box) Insert(object interface{}) (id uint64, err error)
- func (box *Box) IsEmpty() (bool, error)
- func (box *Box) Put(object interface{}) (id uint64, err error)
- func (box *Box) PutAsync(object interface{}) (id uint64, err error)
- func (box *Box) PutMany(objects interface{}) (ids []uint64, err error)
- func (box *Box) Query(conditions ...Condition) *Query
- func (box *Box) QueryOrError(conditions ...Condition) (query *Query, err error)
- func (box *Box) RelationIds(relation *RelationToMany, sourceId uint64) ([]uint64, error)
- func (box *Box) RelationPut(relation *RelationToMany, sourceId, targetId uint64) error
- func (box *Box) RelationRemove(relation *RelationToMany, sourceId, targetId uint64) error
- func (box *Box) RelationReplace(relation *RelationToMany, sourceId uint64, sourceObject interface{}, ...) error
- func (box *Box) Remove(object interface{}) error
- func (box *Box) RemoveAll() error
- func (box *Box) RemoveId(id uint64) error
- func (box *Box) RemoveIds(ids ...uint64) (uint64, error)
- func (box *Box) Update(object interface{}) error
- type Builder
- func (builder *Builder) Build() (*ObjectBox, error)
- func (builder *Builder) BuildOrError() (*ObjectBox, error)
- func (builder *Builder) Directory(path string) *Builder
- func (builder *Builder) MaxReaders(maxReaders uint) *Builder
- func (builder *Builder) MaxSizeInKb(maxSizeInKb uint64) *Builder
- func (builder *Builder) Model(model *Model) *Builder
- type Condition
- type ConditionId
- type Entity
- type Model
- func (model *Model) Entity(name string, id TypeId, uid uint64)
- func (model *Model) EntityFlags(entityFlags int)
- func (model *Model) EntityLastPropertyId(id TypeId, uid uint64)
- func (model *Model) GeneratorVersion(version int)
- func (model *Model) LastEntityId(id TypeId, uid uint64)
- func (model *Model) LastIndexId(id TypeId, uid uint64)
- func (model *Model) LastRelationId(id TypeId, uid uint64)
- func (model *Model) Property(name string, propertyType int, id TypeId, uid uint64)
- func (model *Model) PropertyFlags(propertyFlags int)
- func (model *Model) PropertyIndex(id TypeId, uid uint64)
- func (model *Model) PropertyRelation(targetEntityName string, indexId TypeId, indexUid uint64)
- func (model *Model) RegisterBinding(binding ObjectBinding)
- func (model *Model) Relation(relationId TypeId, relationUid uint64, targetEntityId TypeId, ...)
- type ObjectBinding
- type ObjectBox
- func (ob *ObjectBox) AwaitAsyncCompletion() error
- func (ob *ObjectBox) Close()
- func (ob *ObjectBox) InternalBox(entityId TypeId) *Box
- func (ob *ObjectBox) RunInReadTx(fn func() error) error
- func (ob *ObjectBox) RunInWriteTx(fn func() error) error
- func (ob *ObjectBox) SetDebugFlags(flags uint) error
- func (ob *ObjectBox) SyncClient() (*SyncClient, error)
- type Property
- type PropertyBool
- type PropertyByte
- func (property PropertyByte) Between(a, b byte) Condition
- func (property PropertyByte) Equals(value byte) Condition
- func (property PropertyByte) GreaterOrEqual(value byte) Condition
- func (property PropertyByte) GreaterThan(value byte) Condition
- func (property PropertyByte) LessOrEqual(value byte) Condition
- func (property PropertyByte) LessThan(value byte) Condition
- func (property PropertyByte) NotEquals(value byte) Condition
- func (property PropertyByte) OrderAsc() Condition
- func (property PropertyByte) OrderDesc() Condition
- func (property PropertyByte) OrderNilAsZero() Condition
- func (property PropertyByte) OrderNilLast() Condition
- type PropertyByteVector
- func (property PropertyByteVector) Equals(value []byte) Condition
- func (property PropertyByteVector) GreaterOrEqual(value []byte) Condition
- func (property PropertyByteVector) GreaterThan(value []byte) Condition
- func (property PropertyByteVector) LessOrEqual(value []byte) Condition
- func (property PropertyByteVector) LessThan(value []byte) Condition
- type PropertyFloat32
- func (property PropertyFloat32) Between(a, b float32) Condition
- func (property PropertyFloat32) GreaterOrEqual(value float32) Condition
- func (property PropertyFloat32) GreaterThan(value float32) Condition
- func (property PropertyFloat32) LessOrEqual(value float32) Condition
- func (property PropertyFloat32) LessThan(value float32) Condition
- func (property PropertyFloat32) OrderAsc() Condition
- func (property PropertyFloat32) OrderDesc() Condition
- func (property PropertyFloat32) OrderNilAsZero() Condition
- func (property PropertyFloat32) OrderNilLast() Condition
- type PropertyFloat64
- func (property PropertyFloat64) Between(a, b float64) Condition
- func (property PropertyFloat64) GreaterOrEqual(value float64) Condition
- func (property PropertyFloat64) GreaterThan(value float64) Condition
- func (property PropertyFloat64) LessOrEqual(value float64) Condition
- func (property PropertyFloat64) LessThan(value float64) Condition
- func (property PropertyFloat64) OrderAsc() Condition
- func (property PropertyFloat64) OrderDesc() Condition
- func (property PropertyFloat64) OrderNilAsZero() Condition
- func (property PropertyFloat64) OrderNilLast() Condition
- type PropertyInt
- func (property PropertyInt) Between(a, b int) Condition
- func (property PropertyInt) Equals(value int) Condition
- func (property PropertyInt) GreaterOrEqual(value int) Condition
- func (property PropertyInt) GreaterThan(value int) Condition
- func (property PropertyInt) In(values ...int) Condition
- func (property PropertyInt) LessOrEqual(value int) Condition
- func (property PropertyInt) LessThan(value int) Condition
- func (property PropertyInt) NotEquals(value int) Condition
- func (property PropertyInt) NotIn(values ...int) Condition
- func (property PropertyInt) OrderAsc() Condition
- func (property PropertyInt) OrderDesc() Condition
- func (property PropertyInt) OrderNilAsZero() Condition
- func (property PropertyInt) OrderNilLast() Condition
- type PropertyInt16
- func (property PropertyInt16) Between(a, b int16) Condition
- func (property PropertyInt16) Equals(value int16) Condition
- func (property PropertyInt16) GreaterOrEqual(value int16) Condition
- func (property PropertyInt16) GreaterThan(value int16) Condition
- func (property PropertyInt16) LessOrEqual(value int16) Condition
- func (property PropertyInt16) LessThan(value int16) Condition
- func (property PropertyInt16) NotEquals(value int16) Condition
- func (property PropertyInt16) OrderAsc() Condition
- func (property PropertyInt16) OrderDesc() Condition
- func (property PropertyInt16) OrderNilAsZero() Condition
- func (property PropertyInt16) OrderNilLast() Condition
- type PropertyInt32
- func (property PropertyInt32) Between(a, b int32) Condition
- func (property PropertyInt32) Equals(value int32) Condition
- func (property PropertyInt32) GreaterOrEqual(value int32) Condition
- func (property PropertyInt32) GreaterThan(value int32) Condition
- func (property PropertyInt32) In(values ...int32) Condition
- func (property PropertyInt32) LessOrEqual(value int32) Condition
- func (property PropertyInt32) LessThan(value int32) Condition
- func (property PropertyInt32) NotEquals(value int32) Condition
- func (property PropertyInt32) NotIn(values ...int32) Condition
- func (property PropertyInt32) OrderAsc() Condition
- func (property PropertyInt32) OrderDesc() Condition
- func (property PropertyInt32) OrderNilAsZero() Condition
- func (property PropertyInt32) OrderNilLast() Condition
- type PropertyInt64
- func (property PropertyInt64) Between(a, b int64) Condition
- func (property PropertyInt64) Equals(value int64) Condition
- func (property PropertyInt64) GreaterOrEqual(value int64) Condition
- func (property PropertyInt64) GreaterThan(value int64) Condition
- func (property PropertyInt64) In(values ...int64) Condition
- func (property PropertyInt64) LessOrEqual(value int64) Condition
- func (property PropertyInt64) LessThan(value int64) Condition
- func (property PropertyInt64) NotEquals(value int64) Condition
- func (property PropertyInt64) NotIn(values ...int64) Condition
- func (property PropertyInt64) OrderAsc() Condition
- func (property PropertyInt64) OrderDesc() Condition
- func (property PropertyInt64) OrderNilAsZero() Condition
- func (property PropertyInt64) OrderNilLast() Condition
- type PropertyInt8
- func (property PropertyInt8) Between(a, b int8) Condition
- func (property PropertyInt8) Equals(value int8) Condition
- func (property PropertyInt8) GreaterOrEqual(value int8) Condition
- func (property PropertyInt8) GreaterThan(value int8) Condition
- func (property PropertyInt8) LessOrEqual(value int8) Condition
- func (property PropertyInt8) LessThan(value int8) Condition
- func (property PropertyInt8) NotEquals(value int8) Condition
- func (property PropertyInt8) OrderAsc() Condition
- func (property PropertyInt8) OrderDesc() Condition
- func (property PropertyInt8) OrderNilAsZero() Condition
- func (property PropertyInt8) OrderNilLast() Condition
- type PropertyQuery
- func (pq *PropertyQuery) Average() (float64, error)
- func (pq *PropertyQuery) Close() error
- func (pq *PropertyQuery) Count() (uint64, error)
- func (pq *PropertyQuery) Distinct(value bool) error
- func (pq *PropertyQuery) DistinctString(value, caseSensitive bool) error
- func (pq *PropertyQuery) FindBools(valueIfNil *bool) ([]bool, error)
- func (pq *PropertyQuery) FindFloat32s(valueIfNil *float32) ([]float32, error)
- func (pq *PropertyQuery) FindFloat64s(valueIfNil *float64) ([]float64, error)
- func (pq *PropertyQuery) FindInt16s(valueIfNil *int16) ([]int16, error)
- func (pq *PropertyQuery) FindInt32s(valueIfNil *int32) ([]int32, error)
- func (pq *PropertyQuery) FindInt64s(valueIfNil *int64) ([]int64, error)
- func (pq *PropertyQuery) FindInt8s(valueIfNil *int8) ([]int8, error)
- func (pq *PropertyQuery) FindInts(valueIfNil *int) ([]int, error)
- func (pq *PropertyQuery) FindStrings(valueIfNil *string) ([]string, error)
- func (pq *PropertyQuery) FindUint16s(valueIfNil *uint16) ([]uint16, error)
- func (pq *PropertyQuery) FindUint32s(valueIfNil *uint32) ([]uint32, error)
- func (pq *PropertyQuery) FindUint64s(valueIfNil *uint64) ([]uint64, error)
- func (pq *PropertyQuery) FindUint8s(valueIfNil *uint8) ([]uint8, error)
- func (pq *PropertyQuery) FindUints(valueIfNil *uint) ([]uint, error)
- func (pq *PropertyQuery) Max() (int64, error)
- func (pq *PropertyQuery) MaxFloat64() (float64, error)
- func (pq *PropertyQuery) Min() (int64, error)
- func (pq *PropertyQuery) MinFloat64() (float64, error)
- func (pq *PropertyQuery) Sum() (int64, error)
- func (pq *PropertyQuery) SumFloat64() (float64, error)
- type PropertyRune
- func (property PropertyRune) Between(a, b rune) Condition
- func (property PropertyRune) Equals(value rune) Condition
- func (property PropertyRune) GreaterOrEqual(value rune) Condition
- func (property PropertyRune) GreaterThan(value rune) Condition
- func (property PropertyRune) In(values ...rune) Condition
- func (property PropertyRune) LessOrEqual(value rune) Condition
- func (property PropertyRune) LessThan(value rune) Condition
- func (property PropertyRune) NotEquals(value rune) Condition
- func (property PropertyRune) NotIn(values ...rune) Condition
- func (property PropertyRune) OrderAsc() Condition
- func (property PropertyRune) OrderDesc() Condition
- func (property PropertyRune) OrderNilAsZero() Condition
- func (property PropertyRune) OrderNilLast() Condition
- type PropertyString
- func (property PropertyString) Contains(text string, caseSensitive bool) Condition
- func (property PropertyString) Equals(text string, caseSensitive bool) Condition
- func (property PropertyString) GreaterOrEqual(text string, caseSensitive bool) Condition
- func (property PropertyString) GreaterThan(text string, caseSensitive bool) Condition
- func (property PropertyString) HasPrefix(text string, caseSensitive bool) Condition
- func (property PropertyString) HasSuffix(text string, caseSensitive bool) Condition
- func (property PropertyString) In(caseSensitive bool, texts ...string) Condition
- func (property PropertyString) LessOrEqual(text string, caseSensitive bool) Condition
- func (property PropertyString) LessThan(text string, caseSensitive bool) Condition
- func (property PropertyString) NotEquals(text string, caseSensitive bool) Condition
- func (property PropertyString) OrderAsc(caseSensitive bool) Condition
- func (property PropertyString) OrderDesc(caseSensitive bool) Condition
- func (property PropertyString) OrderNilLast() Condition
- type PropertyStringVector
- type PropertyUint
- func (property PropertyUint) Between(a, b uint) Condition
- func (property PropertyUint) Equals(value uint) Condition
- func (property PropertyUint) GreaterOrEqual(value uint) Condition
- func (property PropertyUint) GreaterThan(value uint) Condition
- func (property PropertyUint) In(values ...uint) Condition
- func (property PropertyUint) LessOrEqual(value uint) Condition
- func (property PropertyUint) LessThan(value uint) Condition
- func (property PropertyUint) NotEquals(value uint) Condition
- func (property PropertyUint) NotIn(values ...uint) Condition
- func (property PropertyUint) OrderAsc() Condition
- func (property PropertyUint) OrderDesc() Condition
- func (property PropertyUint) OrderNilAsZero() Condition
- func (property PropertyUint) OrderNilLast() Condition
- type PropertyUint16
- func (property PropertyUint16) Between(a, b uint16) Condition
- func (property PropertyUint16) Equals(value uint16) Condition
- func (property PropertyUint16) GreaterOrEqual(value uint16) Condition
- func (property PropertyUint16) GreaterThan(value uint16) Condition
- func (property PropertyUint16) LessOrEqual(value uint16) Condition
- func (property PropertyUint16) LessThan(value uint16) Condition
- func (property PropertyUint16) NotEquals(value uint16) Condition
- func (property PropertyUint16) OrderAsc() Condition
- func (property PropertyUint16) OrderDesc() Condition
- func (property PropertyUint16) OrderNilAsZero() Condition
- func (property PropertyUint16) OrderNilLast() Condition
- type PropertyUint32
- func (property PropertyUint32) Between(a, b uint32) Condition
- func (property PropertyUint32) Equals(value uint32) Condition
- func (property PropertyUint32) GreaterOrEqual(value uint32) Condition
- func (property PropertyUint32) GreaterThan(value uint32) Condition
- func (property PropertyUint32) In(values ...uint32) Condition
- func (property PropertyUint32) LessOrEqual(value uint32) Condition
- func (property PropertyUint32) LessThan(value uint32) Condition
- func (property PropertyUint32) NotEquals(value uint32) Condition
- func (property PropertyUint32) NotIn(values ...uint32) Condition
- func (property PropertyUint32) OrderAsc() Condition
- func (property PropertyUint32) OrderDesc() Condition
- func (property PropertyUint32) OrderNilAsZero() Condition
- func (property PropertyUint32) OrderNilLast() Condition
- type PropertyUint64
- func (property PropertyUint64) Between(a, b uint64) Condition
- func (property PropertyUint64) Equals(value uint64) Condition
- func (property PropertyUint64) GreaterOrEqual(value uint64) Condition
- func (property PropertyUint64) GreaterThan(value uint64) Condition
- func (property PropertyUint64) In(values ...uint64) Condition
- func (property PropertyUint64) LessOrEqual(value uint64) Condition
- func (property PropertyUint64) LessThan(value uint64) Condition
- func (property PropertyUint64) NotEquals(value uint64) Condition
- func (property PropertyUint64) NotIn(values ...uint64) Condition
- func (property PropertyUint64) OrderAsc() Condition
- func (property PropertyUint64) OrderDesc() Condition
- func (property PropertyUint64) OrderNilAsZero() Condition
- func (property PropertyUint64) OrderNilLast() Condition
- type PropertyUint8
- func (property PropertyUint8) Between(a, b uint8) Condition
- func (property PropertyUint8) Equals(value uint8) Condition
- func (property PropertyUint8) GreaterOrEqual(value uint8) Condition
- func (property PropertyUint8) GreaterThan(value uint8) Condition
- func (property PropertyUint8) LessOrEqual(value uint8) Condition
- func (property PropertyUint8) LessThan(value uint8) Condition
- func (property PropertyUint8) NotEquals(value uint8) Condition
- func (property PropertyUint8) OrderAsc() Condition
- func (property PropertyUint8) OrderDesc() Condition
- func (property PropertyUint8) OrderNilAsZero() Condition
- func (property PropertyUint8) OrderNilLast() Condition
- type Query
- func (query *Query) Close() error
- func (query *Query) Count() (uint64, error)
- func (query *Query) DescribeParams() (string, error)
- func (query *Query) Find() (objects interface{}, err error)
- func (query *Query) FindIds() ([]uint64, error)
- func (query *Query) Limit(limit uint64) *Query
- func (query *Query) Offset(offset uint64) *Query
- func (query *Query) Property(prop Property) *PropertyQuery
- func (query *Query) PropertyOrError(prop Property) (*PropertyQuery, error)
- func (query *Query) Remove() (count uint64, err error)
- func (query *Query) SetBytesParams(identifier propertyOrAlias, values ...[]byte) error
- func (query *Query) SetFloat64Params(identifier propertyOrAlias, values ...float64) error
- func (query *Query) SetInt32ParamsIn(identifier propertyOrAlias, values ...int32) error
- func (query *Query) SetInt64Params(identifier propertyOrAlias, values ...int64) error
- func (query *Query) SetInt64ParamsIn(identifier propertyOrAlias, values ...int64) error
- func (query *Query) SetStringParams(identifier propertyOrAlias, values ...string) error
- func (query *Query) SetStringParamsIn(identifier propertyOrAlias, values ...string) error
- type QueryBuilder
- func (qb *QueryBuilder) Alias(alias string) error
- func (qb *QueryBuilder) All(ids []ConditionId) (ConditionId, error)
- func (qb *QueryBuilder) Any(ids []ConditionId) (ConditionId, error)
- func (qb *QueryBuilder) Build(box *Box) (*Query, error)
- func (qb *QueryBuilder) BytesEqual(property *BaseProperty, value []byte) (ConditionId, error)
- func (qb *QueryBuilder) BytesGreater(property *BaseProperty, value []byte, withEqual bool) (ConditionId, error)
- func (qb *QueryBuilder) BytesLess(property *BaseProperty, value []byte, withEqual bool) (ConditionId, error)
- func (qb *QueryBuilder) Close() error
- func (qb *QueryBuilder) DoubleBetween(property *BaseProperty, valueA float64, valueB float64) (ConditionId, error)
- func (qb *QueryBuilder) DoubleGreater(property *BaseProperty, value float64, withEqual bool) (ConditionId, error)
- func (qb *QueryBuilder) DoubleLess(property *BaseProperty, value float64, withEqual bool) (ConditionId, error)
- func (qb *QueryBuilder) Int32In(property *BaseProperty, values []int32) (ConditionId, error)
- func (qb *QueryBuilder) Int32NotIn(property *BaseProperty, values []int32) (ConditionId, error)
- func (qb *QueryBuilder) Int64In(property *BaseProperty, values []int64) (ConditionId, error)
- func (qb *QueryBuilder) Int64NotIn(property *BaseProperty, values []int64) (ConditionId, error)
- func (qb *QueryBuilder) IntBetween(property *BaseProperty, value1 int64, value2 int64) (ConditionId, error)
- func (qb *QueryBuilder) IntEqual(property *BaseProperty, value int64) (ConditionId, error)
- func (qb *QueryBuilder) IntGreater(property *BaseProperty, value int64, withEqual bool) (ConditionId, error)
- func (qb *QueryBuilder) IntLess(property *BaseProperty, value int64, withEqual bool) (ConditionId, error)
- func (qb *QueryBuilder) IntNotEqual(property *BaseProperty, value int64) (ConditionId, error)
- func (qb *QueryBuilder) IsNil(property *BaseProperty) (ConditionId, error)
- func (qb *QueryBuilder) IsNotNil(property *BaseProperty) (ConditionId, error)
- func (qb *QueryBuilder) LinkManyToMany(relation *RelationToMany, conditions []Condition) error
- func (qb *QueryBuilder) LinkOneToMany(relation *RelationToOne, conditions []Condition) error
- func (qb *QueryBuilder) StringContains(property *BaseProperty, value string, caseSensitive bool) (ConditionId, error)
- func (qb *QueryBuilder) StringEquals(property *BaseProperty, value string, caseSensitive bool) (ConditionId, error)
- func (qb *QueryBuilder) StringGreater(property *BaseProperty, value string, caseSensitive bool, withEqual bool) (ConditionId, error)
- func (qb *QueryBuilder) StringHasPrefix(property *BaseProperty, value string, caseSensitive bool) (ConditionId, error)
- func (qb *QueryBuilder) StringHasSuffix(property *BaseProperty, value string, caseSensitive bool) (ConditionId, error)
- func (qb *QueryBuilder) StringIn(property *BaseProperty, values []string, caseSensitive bool) (ConditionId, error)
- func (qb *QueryBuilder) StringLess(property *BaseProperty, value string, caseSensitive bool, withEqual bool) (ConditionId, error)
- func (qb *QueryBuilder) StringNotEquals(property *BaseProperty, value string, caseSensitive bool) (ConditionId, error)
- func (qb *QueryBuilder) StringVectorContains(property *BaseProperty, value string, caseSensitive bool) (ConditionId, error)
- type RelationToMany
- type RelationToOne
- func (relation RelationToOne) Equals(value uint64) Condition
- func (relation RelationToOne) In(values ...uint64) Condition
- func (relation *RelationToOne) Link(conditions ...Condition) Condition
- func (relation RelationToOne) NotEquals(value uint64) Condition
- func (relation RelationToOne) NotIn(values ...uint64) Condition
- type SyncChange
- type SyncClient
- func (client *SyncClient) CancelUpdates() error
- func (client *SyncClient) Close() error
- func (client *SyncClient) IsClosed() bool
- func (client *SyncClient) RequestUpdates(alsoSubscribe bool) error
- func (client *SyncClient) SetChangeListener(callback syncChangeListener) error
- func (client *SyncClient) SetCompletionListener(callback syncCompletionListener) error
- func (client *SyncClient) SetConnectionListener(callback syncConnectionListener) error
- func (client *SyncClient) SetCredentials(credentials *SyncCredentials) error
- func (client *SyncClient) SetDisconnectionListener(callback syncDisconnectionListener) error
- func (client *SyncClient) SetLoginFailureListener(callback syncLoginFailureListener) error
- func (client *SyncClient) SetLoginListener(callback syncLoginListener) error
- func (client *SyncClient) SetRequestUpdatesMode(mode syncRequestUpdatesMode) error
- func (client *SyncClient) SetServerTimeListener(callback syncTimeListener) error
- func (client *SyncClient) Start() error
- func (client *SyncClient) State() SyncClientState
- func (client *SyncClient) Stop() error
- func (client *SyncClient) WaitForLogin(timeout time.Duration) (successful bool, err error)
- type SyncClientState
- type SyncCredentials
- type SyncLoginFailure
- type TypeId
- type Version
Constants ¶
const ( // DebugflagsLogTransactionsRead enable read transaction logging DebugflagsLogTransactionsRead = 1 // DebugflagsLogTransactionsWrite enable write transaction logging DebugflagsLogTransactionsWrite = 2 // DebugflagsLogQueries enable query logging DebugflagsLogQueries = 4 // DebugflagsLogQueryParameters enable query parameters logging DebugflagsLogQueryParameters = 8 // DebugflagsLogAsyncQueue enable async operations logging DebugflagsLogAsyncQueue = 16 )
const ( // SyncRequestUpdatesManual configures the client to only get updates when triggered manually using RequestUpdates() SyncRequestUpdatesManual syncRequestUpdatesMode = C.OBXRequestUpdatesMode_MANUAL // SyncRequestUpdatesAutomatic configures the client to get all updates automatically SyncRequestUpdatesAutomatic syncRequestUpdatesMode = C.OBXRequestUpdatesMode_AUTO // SyncRequestUpdatesAutoNoPushes configures the client to get all updates right after a log-in (initial and reconnects) SyncRequestUpdatesAutoNoPushes syncRequestUpdatesMode = C.OBXRequestUpdatesMode_AUTO_NO_PUSHES )
Variables ¶
This section is empty.
Functions ¶
func Alias ¶ added in v1.1.0
func Alias(value string) *alias
Alias wraps a string as an identifier usable for Query.Set*Params*() methods.
func NanoTimeInt64ConvertToDatabaseValue ¶ added in v1.4.0
NanoTimeInt64ConvertToDatabaseValue converts time.Time to Unix timestamp in nanoseconds (internal format expected by ObjectBox on a date-nano field)
func NanoTimeInt64ConvertToEntityProperty ¶ added in v1.4.0
NanoTimeInt64ConvertToEntityProperty converts Unix timestamp in nanoseconds (ObjectBox date-nano field) to time.Time
func StringIdConvertToDatabaseValue ¶ added in v0.9.0
StringIdConvertToDatabaseValue implements "StringIdConvert" property value converter
func StringIdConvertToEntityProperty ¶ added in v0.9.0
StringIdConvertToEntityProperty implements "StringIdConvert" property value converter
func SyncIsAvailable ¶ added in v1.3.0
func SyncIsAvailable() bool
SyncIsAvailable returns true if the loaded ObjectBox native library supports Sync. [ObjectBox Sync](https://objectbox.io/sync/) makes data available and synchronized across devices, online and offline.
func TimeBinaryConvertToDatabaseValue ¶ added in v1.1.0
TimeBinaryConvertToDatabaseValue uses time.Time.MarshalBinary() to encode time.Time.
func TimeBinaryConvertToEntityProperty ¶ added in v1.1.0
TimeBinaryConvertToEntityProperty uses time.Time.UnmarshalBinary() to decode time.Time.
func TimeInt64ConvertToDatabaseValue ¶ added in v1.1.0
TimeInt64ConvertToDatabaseValue converts time.Time to Unix timestamp in milliseconds (internal format expected by ObjectBox on a date field) NOTE - you lose precision - anything smaller then milliseconds is dropped
func TimeInt64ConvertToEntityProperty ¶ added in v1.1.0
TimeInt64ConvertToEntityProperty converts Unix timestamp in milliseconds (ObjectBox date field) to time.Time NOTE - you lose precision - anything smaller then milliseconds is dropped
func TimeTextConvertToDatabaseValue ¶ added in v1.1.0
TimeTextConvertToDatabaseValue uses time.Time.MarshalText() to encode time.Time into RFC 3339 formatted string.
func TimeTextConvertToEntityProperty ¶ added in v1.1.0
TimeTextConvertToEntityProperty uses time.Time.UnmarshalText() to decode RFC 3339 formatted string to time.Time.
func VersionInfo ¶ added in v0.8.0
func VersionInfo() string
VersionInfo returns a printable version string
Types ¶
type AsyncBox ¶ added in v1.1.0
type AsyncBox struct {
// contains filtered or unexported fields
}
AsyncBox provides asynchronous operations on objects of a common type.
Asynchronous operations are executed on a separate internal thread for better performance.
There are two main use cases:
1) "execute & forget:" you gain faster put/remove operations as you don't have to wait for the transaction to finish.
2) Many small transactions: if your write load is typically a lot of individual puts that happen in parallel, this will merge small transactions into bigger ones. This results in a significant gain in overall throughput.
In situations with (extremely) high async load, an async method may be throttled (~1ms) or delayed up to 1 second. In the unlikely event that the object could still not be enqueued (full queue), an error will be returned.
Note that async methods do not give you hard durability guarantees like the synchronous Box provides. There is a small time window in which the data may not have been committed durably yet.
func NewAsyncBox ¶ added in v1.1.0
NewAsyncBox creates a new async box with the given operation timeout in case an async queue is full. The returned struct must be freed explicitly using the Close() method. It's usually preferable to use Box::Async() which takes care of resource management and doesn't require closing.
func (*AsyncBox) AwaitCompletion ¶ added in v1.1.0
AwaitCompletion waits for all (including future) async submissions to be completed (the async queue becomes idle for a moment). Currently this is not limited to the single entity this AsyncBox is working on but all entities in the store. Returns an error if shutting down or an error occurred
func (*AsyncBox) AwaitSubmitted ¶ added in v1.1.0
AwaitSubmitted for previously submitted async operations to be completed (the async queue does not have to become idle). Currently this is not limited to the single entity this AsyncBox is working on but all entities in the store. Returns an error if shutting down or an error occurred
func (*AsyncBox) Close ¶ added in v1.1.0
Close frees resources of a customized AsyncBox (e.g. with a custom timeout). Not necessary for the standard (shared) instance from box.Async(); Close() can still be called for those: it just won't have any effect.
func (*AsyncBox) Insert ¶ added in v1.1.0
Insert a single object asynchronously. The ID property on the passed object will be assigned a new ID the entity would hold if the insert is ultimately successful. The newly assigned ID may not become valid if the insert fails. Fails silently if an object with the same ID already exists (this error is not returned).
func (*AsyncBox) Put ¶ added in v1.1.0
Put inserts/updates a single object asynchronously. When inserting a new object, the ID property on the passed object will be assigned a new ID the entity would hold if the insert is ultimately successful. The newly assigned ID may not become valid if the insert fails.
type BaseProperty ¶ added in v0.9.0
BaseProperty serves as a common base for all the property types
func (BaseProperty) IsNil ¶ added in v1.0.0
func (property BaseProperty) IsNil() Condition
IsNil finds entities with the stored property value nil
func (BaseProperty) IsNotNil ¶ added in v1.0.0
func (property BaseProperty) IsNotNil() Condition
IsNotNil finds entities with the stored property value not nil
type Box ¶
type Box struct { ObjectBox *ObjectBox // contains filtered or unexported fields }
Box provides CRUD access to objects of a common type
func (*Box) Async ¶ added in v1.1.0
Async provides access to the default Async Box for asynchronous operations. See AsyncBox for more information.
func (*Box) Contains ¶ added in v0.9.0
Contains checks whether an object with the given ID is stored.
func (*Box) ContainsIds ¶ added in v1.0.0
ContainsIds checks whether all of the given objects are stored in DB.
func (*Box) CountMax ¶ added in v0.9.0
CountMax returns a number of objects stored (up to a given maximum) passing limit=0 is the same as calling Count() - counts all objects without a limit
func (*Box) Get ¶
Get reads a single object.
Returns an interface that should be cast to the appropriate type. Returns nil in case the object with the given ID doesn't exist. The cast is done automatically when using the generated BoxFor* code.
func (*Box) GetAll ¶
GetAll reads all stored objects.
Returns a slice of objects that should be cast to the appropriate type. The cast is done automatically when using the generated BoxFor* code.
func (*Box) GetMany ¶ added in v1.0.0
GetMany reads multiple objects at once.
Returns a slice of objects that should be cast to the appropriate type. The cast is done automatically when using the generated BoxFor* code. If any of the objects doesn't exist, its position in the return slice
is nil or an empty object (depends on the binding)
func (*Box) GetManyExisting ¶ added in v1.1.0
GetManyExisting reads multiple objects at once, skipping those that do not exist.
Returns a slice of objects that should be cast to the appropriate type. The cast is done automatically when using the generated BoxFor* code.
func (*Box) Insert ¶ added in v1.1.0
Insert synchronously inserts a single object. As opposed to Put, Insert will fail if an object with the same ID already exists. In case the ID is not specified, it would be assigned automatically (auto-increment). When inserting, the ID property on the passed object will be assigned the new ID as well.
func (*Box) Put ¶
Put synchronously inserts/updates a single object. In case the ID is not specified, it would be assigned automatically (auto-increment). When inserting, the ID property on the passed object will be assigned the new ID as well.
func (*Box) PutAsync ¶
PutAsync asynchronously inserts/updates a single object. Deprecated: use box.Async().Put() instead
func (*Box) PutMany ¶ added in v1.0.0
PutMany inserts multiple objects in a single transaction. The given argument must be a slice of the object type this Box represents (pointers to objects). In case IDs are not set on the objects, they would be assigned automatically (auto-increment).
Returns: IDs of the put objects (in the same order).
Note: In case an error occurs during the transaction, some of the objects may already have the ID assigned even though the transaction has been rolled back and the objects are not stored under those IDs.
Note: The slice may be empty or even nil; in both cases, an empty IDs slice and no error is returned.
func (*Box) Query ¶ added in v0.8.0
Query creates a query with the given conditions. Use generated properties to create conditions. Keep the Query object if you intend to execute it multiple times. Note: this function panics if you try to create illegal queries; e.g. use properties of an alien type. This is typically a programming error. Use QueryOrError instead if you want the explicit error check.
func (*Box) QueryOrError ¶ added in v0.8.0
QueryOrError is like Query() but with error handling; e.g. when you build conditions dynamically that may fail.
func (*Box) RelationIds ¶ added in v1.0.0
func (box *Box) RelationIds(relation *RelationToMany, sourceId uint64) ([]uint64, error)
RelationIds returns IDs of all target objects related to the given source object ID
func (*Box) RelationPut ¶ added in v1.0.0
func (box *Box) RelationPut(relation *RelationToMany, sourceId, targetId uint64) error
RelationPut creates a relation between the given source & target objects
func (*Box) RelationRemove ¶ added in v1.0.0
func (box *Box) RelationRemove(relation *RelationToMany, sourceId, targetId uint64) error
RelationRemove removes a relation between the given source & target objects
func (*Box) RelationReplace ¶ added in v1.0.0
func (box *Box) RelationReplace(relation *RelationToMany, sourceId uint64, sourceObject interface{}, targetObjects interface{}) error
RelationReplace replaces all targets for a given source in a standalone many-to-many relation It also inserts new related objects (with a 0 ID).
func (*Box) RemoveAll ¶
RemoveAll removes all stored objects. This is much faster than removing objects one by one in a loop.
func (*Box) RemoveIds ¶ added in v1.0.0
RemoveIds deletes multiple objects at once. Returns the number of deleted object or error on failure. Note that this method will not fail if an object is not found (e.g. already removed). In case you need to strictly check whether all of the objects exist before removing them, you can execute multiple box.Contains() and box.Remove() inside a single write transaction.
type Builder ¶
type Builder struct { Error error // contains filtered or unexported fields }
Builder provides tools to fully configure and construct ObjectBox
func NewBuilder ¶
func NewBuilder() *Builder
NewBuilder creates a new ObjectBox instance builder object
func (*Builder) Build ¶
Build validates the configuration and tries to init the ObjectBox. This call panics on failures; if ObjectBox is optional for your app, consider BuildOrError().
func (*Builder) BuildOrError ¶ added in v0.8.0
BuildOrError validates the configuration and tries to init the ObjectBox.
func (*Builder) MaxReaders ¶
MaxReaders defines maximum concurrent readers (default: 126). Increase only if you are getting errors (highly concurrent scenarios).
func (*Builder) MaxSizeInKb ¶
MaxSizeInKb defines maximum size the database can take on disk (default: 1 GByte).
type Condition ¶ added in v0.8.0
type Condition interface { // Alias sets a string alias for the given condition. It can later be used in Query.Set*Params() methods. Alias(alias string) Condition // As sets a string alias for the given condition. It can later be used in Query.Set*Params() methods. As(alias *alias) Condition // contains filtered or unexported methods }
Condition is used by Query to limit object selection or specify their order
type ConditionId ¶ added in v0.8.0
type ConditionId = int32
ConditionId is a condition identifier type, used when building queries
type Entity ¶ added in v0.8.0
type Entity struct {
Id TypeId
}
Entity is used to specify model in the generated binding code
type Model ¶
type Model struct { Error error // contains filtered or unexported fields }
Model is used by the generated code to represent information about the ObjectBox database schema
func (*Model) EntityFlags ¶ added in v1.3.0
EntityFlags configures behavior of entities
func (*Model) EntityLastPropertyId ¶
EntityLastPropertyId declares a property with the highest ID. Used as a compatibility check when opening DB with an older model version.
func (*Model) GeneratorVersion ¶ added in v0.8.0
GeneratorVersion configures version of the generator used to create this model
func (*Model) LastEntityId ¶
LastEntityId declares an entity with the highest ID. Used as a compatibility check when opening DB with an older model version.
func (*Model) LastIndexId ¶
LastIndexId declares an index with the highest ID. Used as a compatibility check when opening DB with an older model version.
func (*Model) LastRelationId ¶
LastRelationId declares a relation with the highest ID. Used as a compatibility check when opening DB with an older model version.
func (*Model) PropertyFlags ¶
PropertyFlags configures type and other information about the property
func (*Model) PropertyIndex ¶
PropertyIndex creates a new index on the property
func (*Model) PropertyRelation ¶
PropertyRelation adds a property-based (i.e. to-one) relation
func (*Model) RegisterBinding ¶
func (model *Model) RegisterBinding(binding ObjectBinding)
RegisterBinding attaches generated binding code to the model. The binding is used by ObjectBox for marshalling and other typed operations.
type ObjectBinding ¶
type ObjectBinding interface { // AddToModel adds the entity information, including properties, indexes, etc., to the model during construction. AddToModel(model *Model) // GetId reads the ID field of the given object. GetId(object interface{}) (id uint64, err error) // SetId sets the ID field on the given object. SetId(object interface{}, id uint64) error // PutRelated updates/inserts objects related to the given object, based on the available object data. PutRelated(ob *ObjectBox, object interface{}, id uint64) error // Flatten serializes the object to FlatBuffers. The given ID must be used instead of the object field. Flatten(object interface{}, fbb *flatbuffers.Builder, id uint64) error // Load constructs the object from serialized byte buffer. Also reads data for eagerly loaded related entities. Load(ob *ObjectBox, bytes []byte) (interface{}, error) // MakeSlice creates a slice of objects with the given capacity (0 length). MakeSlice(capacity int) interface{} // AppendToSlice adds the object at the end of the slice created by MakeSlice(). Returns the new slice. AppendToSlice(slice interface{}, object interface{}) (sliceNew interface{}) // GeneratorVersion returns the version used to generate this binding - used to verify the compatibility. GeneratorVersion() int }
ObjectBinding provides an interface for various object types to be included in the model
type ObjectBox ¶
type ObjectBox struct {
// contains filtered or unexported fields
}
ObjectBox provides super-fast object storage
func (*ObjectBox) AwaitAsyncCompletion ¶
AwaitAsyncCompletion blocks until all PutAsync insert have been processed
func (*ObjectBox) Close ¶
func (ob *ObjectBox) Close()
Close fully closes the database and frees resources
func (*ObjectBox) InternalBox ¶ added in v0.8.0
InternalBox returns an Entity Box or panics on error (in case entity with the given ID doesn't exist)
func (*ObjectBox) RunInReadTx ¶ added in v1.0.0
RunInReadTx executes the given function inside a read transaction. The execution of the function `fn` must be sequential and executed in the same thread, which is enforced internally. If you launch goroutines inside `fn`, they will be executed on separate threads and not part of the same transaction. Multiple read transaction may be executed concurrently. The error returned by your callback is passed-through as the output error
func (*ObjectBox) RunInWriteTx ¶ added in v1.0.0
RunInWriteTx executes the given function inside a write transaction. The execution of the function `fn` must be sequential and executed in the same thread, which is enforced internally. If you launch goroutines inside `fn`, they will be executed on separate threads and not part of the same transaction. Only one write transaction may be active at a time (concurrently). The error returned by your callback is passed-through as the output error. If the resulting error is not nil, the transaction is aborted (rolled-back)
func (*ObjectBox) SetDebugFlags ¶
SetDebugFlags configures debug logging of the ObjectBox core. See DebugFlags* constants
func (*ObjectBox) SyncClient ¶ added in v1.3.0
func (ob *ObjectBox) SyncClient() (*SyncClient, error)
SyncClient returns an existing client associated with the store or nil if not available. Use NewSyncClient() to create it the first time.
type Property ¶ added in v0.8.0
type Property interface {
// contains filtered or unexported methods
}
Property represents any property type
type PropertyBool ¶ added in v0.8.0
type PropertyBool struct {
*BaseProperty
}
PropertyBool holds information about a property and provides query building methods
func (PropertyBool) Equals ¶ added in v0.8.0
func (property PropertyBool) Equals(value bool) Condition
Equals finds entities with the stored property value equal to the given value
func (PropertyBool) OrderAsc ¶ added in v1.1.0
func (property PropertyBool) OrderAsc() Condition
OrderAsc sets ascending order based on this property
func (PropertyBool) OrderDesc ¶ added in v1.1.0
func (property PropertyBool) OrderDesc() Condition
OrderDesc sets descending order based on this property
func (PropertyBool) OrderNilAsFalse ¶ added in v1.1.0
func (property PropertyBool) OrderNilAsFalse() Condition
OrderNilAsFalse treats the nil value of the property the same as if it was 0
func (PropertyBool) OrderNilLast ¶ added in v1.1.0
func (property PropertyBool) OrderNilLast() Condition
OrderNilLast puts objects with nil value of the property at the end of the result set
type PropertyByte ¶ added in v0.8.0
type PropertyByte struct {
*BaseProperty
}
PropertyByte holds information about a property and provides query building methods
func (PropertyByte) Between ¶ added in v0.8.0
func (property PropertyByte) Between(a, b byte) Condition
Between finds entities with the stored property value between a and b (including a and b)
func (PropertyByte) Equals ¶ added in v0.8.0
func (property PropertyByte) Equals(value byte) Condition
Equals finds entities with the stored property value equal to the given value
func (PropertyByte) GreaterOrEqual ¶ added in v1.3.0
func (property PropertyByte) GreaterOrEqual(value byte) Condition
GreaterOrEqual finds entities with the stored property value greater than the given value
func (PropertyByte) GreaterThan ¶ added in v0.8.0
func (property PropertyByte) GreaterThan(value byte) Condition
GreaterThan finds entities with the stored property value greater than the given value
func (PropertyByte) LessOrEqual ¶ added in v1.3.0
func (property PropertyByte) LessOrEqual(value byte) Condition
LessOrEqual finds entities with the stored property value less than the given value
func (PropertyByte) LessThan ¶ added in v0.8.0
func (property PropertyByte) LessThan(value byte) Condition
LessThan finds entities with the stored property value less than the given value
func (PropertyByte) NotEquals ¶ added in v0.8.0
func (property PropertyByte) NotEquals(value byte) Condition
NotEquals finds entities with the stored property value different than the given value
func (PropertyByte) OrderAsc ¶ added in v1.1.0
func (property PropertyByte) OrderAsc() Condition
OrderAsc sets ascending order based on this property
func (PropertyByte) OrderDesc ¶ added in v1.1.0
func (property PropertyByte) OrderDesc() Condition
OrderDesc sets descending order based on this property
func (PropertyByte) OrderNilAsZero ¶ added in v1.1.0
func (property PropertyByte) OrderNilAsZero() Condition
OrderNilAsZero treats the nil value of the property the same as if it was 0
func (PropertyByte) OrderNilLast ¶ added in v1.1.0
func (property PropertyByte) OrderNilLast() Condition
OrderNilLast puts objects with nil value of the property at the end of the result set
type PropertyByteVector ¶ added in v0.8.0
type PropertyByteVector struct {
*BaseProperty
}
PropertyByteVector holds information about a property and provides query building methods
func (PropertyByteVector) Equals ¶ added in v0.8.0
func (property PropertyByteVector) Equals(value []byte) Condition
Equals finds entities with the stored property value equal to the given value
func (PropertyByteVector) GreaterOrEqual ¶ added in v0.8.0
func (property PropertyByteVector) GreaterOrEqual(value []byte) Condition
GreaterOrEqual finds entities with the stored property value greater than the given value or they're equal
func (PropertyByteVector) GreaterThan ¶ added in v0.8.0
func (property PropertyByteVector) GreaterThan(value []byte) Condition
GreaterThan finds entities with the stored property value greater than the given value
func (PropertyByteVector) LessOrEqual ¶ added in v0.8.0
func (property PropertyByteVector) LessOrEqual(value []byte) Condition
LessOrEqual finds entities with the stored property value less than the given value or they're equal
func (PropertyByteVector) LessThan ¶ added in v0.8.0
func (property PropertyByteVector) LessThan(value []byte) Condition
LessThan finds entities with the stored property value less than the given value
type PropertyFloat32 ¶ added in v0.8.0
type PropertyFloat32 struct {
*BaseProperty
}
PropertyFloat32 holds information about a property and provides query building methods
func (PropertyFloat32) Between ¶ added in v0.8.0
func (property PropertyFloat32) Between(a, b float32) Condition
Between finds entities with the stored property value between a and b (including a and b)
func (PropertyFloat32) GreaterOrEqual ¶ added in v1.3.0
func (property PropertyFloat32) GreaterOrEqual(value float32) Condition
GreaterOrEqual finds entities with the stored property value greater than the given value
func (PropertyFloat32) GreaterThan ¶ added in v0.8.0
func (property PropertyFloat32) GreaterThan(value float32) Condition
GreaterThan finds entities with the stored property value greater than the given value
func (PropertyFloat32) LessOrEqual ¶ added in v1.3.0
func (property PropertyFloat32) LessOrEqual(value float32) Condition
LessOrEqual finds entities with the stored property value less than the given value
func (PropertyFloat32) LessThan ¶ added in v0.8.0
func (property PropertyFloat32) LessThan(value float32) Condition
LessThan finds entities with the stored property value less than the given value
func (PropertyFloat32) OrderAsc ¶ added in v1.1.0
func (property PropertyFloat32) OrderAsc() Condition
OrderAsc sets ascending order based on this property
func (PropertyFloat32) OrderDesc ¶ added in v1.1.0
func (property PropertyFloat32) OrderDesc() Condition
OrderDesc sets descending order based on this property
func (PropertyFloat32) OrderNilAsZero ¶ added in v1.1.0
func (property PropertyFloat32) OrderNilAsZero() Condition
OrderNilAsZero treats the nil value of the property the same as if it was 0
func (PropertyFloat32) OrderNilLast ¶ added in v1.1.0
func (property PropertyFloat32) OrderNilLast() Condition
OrderNilLast puts objects with nil value of the property at the end of the result set
type PropertyFloat64 ¶ added in v0.8.0
type PropertyFloat64 struct {
*BaseProperty
}
PropertyFloat64 holds information about a property and provides query building methods
func (PropertyFloat64) Between ¶ added in v0.8.0
func (property PropertyFloat64) Between(a, b float64) Condition
Between finds entities with the stored property value between a and b (including a and b)
func (PropertyFloat64) GreaterOrEqual ¶ added in v1.3.0
func (property PropertyFloat64) GreaterOrEqual(value float64) Condition
GreaterOrEqual finds entities with the stored property value greater than the given value
func (PropertyFloat64) GreaterThan ¶ added in v0.8.0
func (property PropertyFloat64) GreaterThan(value float64) Condition
GreaterThan finds entities with the stored property value greater than the given value
func (PropertyFloat64) LessOrEqual ¶ added in v1.3.0
func (property PropertyFloat64) LessOrEqual(value float64) Condition
LessOrEqual finds entities with the stored property value less than the given value
func (PropertyFloat64) LessThan ¶ added in v0.8.0
func (property PropertyFloat64) LessThan(value float64) Condition
LessThan finds entities with the stored property value less than the given value
func (PropertyFloat64) OrderAsc ¶ added in v1.1.0
func (property PropertyFloat64) OrderAsc() Condition
OrderAsc sets ascending order based on this property
func (PropertyFloat64) OrderDesc ¶ added in v1.1.0
func (property PropertyFloat64) OrderDesc() Condition
OrderDesc sets descending order based on this property
func (PropertyFloat64) OrderNilAsZero ¶ added in v1.1.0
func (property PropertyFloat64) OrderNilAsZero() Condition
OrderNilAsZero treats the nil value of the property the same as if it was 0
func (PropertyFloat64) OrderNilLast ¶ added in v1.1.0
func (property PropertyFloat64) OrderNilLast() Condition
OrderNilLast puts objects with nil value of the property at the end of the result set
type PropertyInt ¶ added in v0.8.0
type PropertyInt struct {
*BaseProperty
}
PropertyInt holds information about a property and provides query building methods
func (PropertyInt) Between ¶ added in v0.8.0
func (property PropertyInt) Between(a, b int) Condition
Between finds entities with the stored property value between a and b (including a and b)
func (PropertyInt) Equals ¶ added in v0.8.0
func (property PropertyInt) Equals(value int) Condition
Equals finds entities with the stored property value equal to the given value
func (PropertyInt) GreaterOrEqual ¶ added in v1.3.0
func (property PropertyInt) GreaterOrEqual(value int) Condition
GreaterOrEqual finds entities with the stored property value greater than the given value or they're equal
func (PropertyInt) GreaterThan ¶ added in v0.8.0
func (property PropertyInt) GreaterThan(value int) Condition
GreaterThan finds entities with the stored property value greater than the given value
func (PropertyInt) In ¶ added in v0.8.0
func (property PropertyInt) In(values ...int) Condition
In finds entities with the stored property value equal to any of the given values
func (PropertyInt) LessOrEqual ¶ added in v1.3.0
func (property PropertyInt) LessOrEqual(value int) Condition
LessOrEqual finds entities with the stored property value less than the given value or they're equal
func (PropertyInt) LessThan ¶ added in v0.8.0
func (property PropertyInt) LessThan(value int) Condition
LessThan finds entities with the stored property value less than the given value
func (PropertyInt) NotEquals ¶ added in v0.8.0
func (property PropertyInt) NotEquals(value int) Condition
NotEquals finds entities with the stored property value different than the given value
func (PropertyInt) NotIn ¶ added in v0.8.0
func (property PropertyInt) NotIn(values ...int) Condition
NotIn finds entities with the stored property value not equal to any of the given values
func (PropertyInt) OrderAsc ¶ added in v1.1.0
func (property PropertyInt) OrderAsc() Condition
OrderAsc sets ascending order based on this property
func (PropertyInt) OrderDesc ¶ added in v1.1.0
func (property PropertyInt) OrderDesc() Condition
OrderDesc sets descending order based on this property
func (PropertyInt) OrderNilAsZero ¶ added in v1.1.0
func (property PropertyInt) OrderNilAsZero() Condition
OrderNilAsZero treats the nil value of the property the same as if it was 0
func (PropertyInt) OrderNilLast ¶ added in v1.1.0
func (property PropertyInt) OrderNilLast() Condition
OrderNilLast puts objects with nil value of the property at the end of the result set
type PropertyInt16 ¶ added in v0.8.0
type PropertyInt16 struct {
*BaseProperty
}
PropertyInt16 holds information about a property and provides query building methods
func (PropertyInt16) Between ¶ added in v0.8.0
func (property PropertyInt16) Between(a, b int16) Condition
Between finds entities with the stored property value between a and b (including a and b)
func (PropertyInt16) Equals ¶ added in v0.8.0
func (property PropertyInt16) Equals(value int16) Condition
Equals finds entities with the stored property value equal to the given value
func (PropertyInt16) GreaterOrEqual ¶ added in v1.3.0
func (property PropertyInt16) GreaterOrEqual(value int16) Condition
GreaterOrEqual finds entities with the stored property value greater than the given value
func (PropertyInt16) GreaterThan ¶ added in v0.8.0
func (property PropertyInt16) GreaterThan(value int16) Condition
GreaterThan finds entities with the stored property value greater than the given value
func (PropertyInt16) LessOrEqual ¶ added in v1.3.0
func (property PropertyInt16) LessOrEqual(value int16) Condition
LessOrEqual finds entities with the stored property value less than the given value
func (PropertyInt16) LessThan ¶ added in v0.8.0
func (property PropertyInt16) LessThan(value int16) Condition
LessThan finds entities with the stored property value less than the given value
func (PropertyInt16) NotEquals ¶ added in v0.8.0
func (property PropertyInt16) NotEquals(value int16) Condition
NotEquals finds entities with the stored property value different than the given value
func (PropertyInt16) OrderAsc ¶ added in v1.1.0
func (property PropertyInt16) OrderAsc() Condition
OrderAsc sets ascending order based on this property
func (PropertyInt16) OrderDesc ¶ added in v1.1.0
func (property PropertyInt16) OrderDesc() Condition
OrderDesc sets descending order based on this property
func (PropertyInt16) OrderNilAsZero ¶ added in v1.1.0
func (property PropertyInt16) OrderNilAsZero() Condition
OrderNilAsZero treats the nil value of the property the same as if it was 0
func (PropertyInt16) OrderNilLast ¶ added in v1.1.0
func (property PropertyInt16) OrderNilLast() Condition
OrderNilLast puts objects with nil value of the property at the end of the result set
type PropertyInt32 ¶ added in v0.8.0
type PropertyInt32 struct {
*BaseProperty
}
PropertyInt32 holds information about a property and provides query building methods
func (PropertyInt32) Between ¶ added in v0.8.0
func (property PropertyInt32) Between(a, b int32) Condition
Between finds entities with the stored property value between a and b (including a and b)
func (PropertyInt32) Equals ¶ added in v0.8.0
func (property PropertyInt32) Equals(value int32) Condition
Equals finds entities with the stored property value equal to the given value
func (PropertyInt32) GreaterOrEqual ¶ added in v1.3.0
func (property PropertyInt32) GreaterOrEqual(value int32) Condition
GreaterOrEqual finds entities with the stored property value greater than the given value
func (PropertyInt32) GreaterThan ¶ added in v0.8.0
func (property PropertyInt32) GreaterThan(value int32) Condition
GreaterThan finds entities with the stored property value greater than the given value
func (PropertyInt32) In ¶ added in v0.8.0
func (property PropertyInt32) In(values ...int32) Condition
In finds entities with the stored property value equal to any of the given values
func (PropertyInt32) LessOrEqual ¶ added in v1.3.0
func (property PropertyInt32) LessOrEqual(value int32) Condition
LessOrEqual finds entities with the stored property value less than the given value
func (PropertyInt32) LessThan ¶ added in v0.8.0
func (property PropertyInt32) LessThan(value int32) Condition
LessThan finds entities with the stored property value less than the given value
func (PropertyInt32) NotEquals ¶ added in v0.8.0
func (property PropertyInt32) NotEquals(value int32) Condition
NotEquals finds entities with the stored property value different than the given value
func (PropertyInt32) NotIn ¶ added in v0.8.0
func (property PropertyInt32) NotIn(values ...int32) Condition
NotIn finds entities with the stored property value not equal to any of the given values
func (PropertyInt32) OrderAsc ¶ added in v1.1.0
func (property PropertyInt32) OrderAsc() Condition
OrderAsc sets ascending order based on this property
func (PropertyInt32) OrderDesc ¶ added in v1.1.0
func (property PropertyInt32) OrderDesc() Condition
OrderDesc sets descending order based on this property
func (PropertyInt32) OrderNilAsZero ¶ added in v1.1.0
func (property PropertyInt32) OrderNilAsZero() Condition
OrderNilAsZero treats the nil value of the property the same as if it was 0
func (PropertyInt32) OrderNilLast ¶ added in v1.1.0
func (property PropertyInt32) OrderNilLast() Condition
OrderNilLast puts objects with nil value of the property at the end of the result set
type PropertyInt64 ¶ added in v0.8.0
type PropertyInt64 struct {
*BaseProperty
}
PropertyInt64 holds information about a property and provides query building methods
func (PropertyInt64) Between ¶ added in v0.8.0
func (property PropertyInt64) Between(a, b int64) Condition
Between finds entities with the stored property value between a and b (including a and b)
func (PropertyInt64) Equals ¶ added in v0.8.0
func (property PropertyInt64) Equals(value int64) Condition
Equals finds entities with the stored property value equal to the given value
func (PropertyInt64) GreaterOrEqual ¶ added in v1.3.0
func (property PropertyInt64) GreaterOrEqual(value int64) Condition
GreaterOrEqual finds entities with the stored property value greater than the given value or they're equal
func (PropertyInt64) GreaterThan ¶ added in v0.8.0
func (property PropertyInt64) GreaterThan(value int64) Condition
GreaterThan finds entities with the stored property value greater than the given value
func (PropertyInt64) In ¶ added in v0.8.0
func (property PropertyInt64) In(values ...int64) Condition
In finds entities with the stored property value equal to any of the given values
func (PropertyInt64) LessOrEqual ¶ added in v1.3.0
func (property PropertyInt64) LessOrEqual(value int64) Condition
LessOrEqual finds entities with the stored property value less than the given value or they're equal
func (PropertyInt64) LessThan ¶ added in v0.8.0
func (property PropertyInt64) LessThan(value int64) Condition
LessThan finds entities with the stored property value less than the given value
func (PropertyInt64) NotEquals ¶ added in v0.8.0
func (property PropertyInt64) NotEquals(value int64) Condition
NotEquals finds entities with the stored property value different than the given value
func (PropertyInt64) NotIn ¶ added in v0.8.0
func (property PropertyInt64) NotIn(values ...int64) Condition
NotIn finds entities with the stored property value not equal to any of the given values
func (PropertyInt64) OrderAsc ¶ added in v1.1.0
func (property PropertyInt64) OrderAsc() Condition
OrderAsc sets ascending order based on this property
func (PropertyInt64) OrderDesc ¶ added in v1.1.0
func (property PropertyInt64) OrderDesc() Condition
OrderDesc sets descending order based on this property
func (PropertyInt64) OrderNilAsZero ¶ added in v1.1.0
func (property PropertyInt64) OrderNilAsZero() Condition
OrderNilAsZero treats the nil value of the property the same as if it was 0
func (PropertyInt64) OrderNilLast ¶ added in v1.1.0
func (property PropertyInt64) OrderNilLast() Condition
OrderNilLast puts objects with nil value of the property at the end of the result set
type PropertyInt8 ¶ added in v0.8.0
type PropertyInt8 struct {
*BaseProperty
}
PropertyInt8 holds information about a property and provides query building methods
func (PropertyInt8) Between ¶ added in v0.8.0
func (property PropertyInt8) Between(a, b int8) Condition
Between finds entities with the stored property value between a and b (including a and b)
func (PropertyInt8) Equals ¶ added in v0.8.0
func (property PropertyInt8) Equals(value int8) Condition
Equals finds entities with the stored property value equal to the given value
func (PropertyInt8) GreaterOrEqual ¶ added in v1.3.0
func (property PropertyInt8) GreaterOrEqual(value int8) Condition
GreaterOrEqual finds entities with the stored property value greater than the given value
func (PropertyInt8) GreaterThan ¶ added in v0.8.0
func (property PropertyInt8) GreaterThan(value int8) Condition
GreaterThan finds entities with the stored property value greater than the given value
func (PropertyInt8) LessOrEqual ¶ added in v1.3.0
func (property PropertyInt8) LessOrEqual(value int8) Condition
LessOrEqual finds entities with the stored property value less than the given value
func (PropertyInt8) LessThan ¶ added in v0.8.0
func (property PropertyInt8) LessThan(value int8) Condition
LessThan finds entities with the stored property value less than the given value
func (PropertyInt8) NotEquals ¶ added in v0.8.0
func (property PropertyInt8) NotEquals(value int8) Condition
NotEquals finds entities with the stored property value different than the given value
func (PropertyInt8) OrderAsc ¶ added in v1.1.0
func (property PropertyInt8) OrderAsc() Condition
OrderAsc sets ascending order based on this property
func (PropertyInt8) OrderDesc ¶ added in v1.1.0
func (property PropertyInt8) OrderDesc() Condition
OrderDesc sets descending order based on this property
func (PropertyInt8) OrderNilAsZero ¶ added in v1.1.0
func (property PropertyInt8) OrderNilAsZero() Condition
OrderNilAsZero treats the nil value of the property the same as if it was 0
func (PropertyInt8) OrderNilLast ¶ added in v1.1.0
func (property PropertyInt8) OrderNilLast() Condition
OrderNilLast puts objects with nil value of the property at the end of the result set
type PropertyQuery ¶ added in v1.5.0
type PropertyQuery struct {
// contains filtered or unexported fields
}
PropertyQuery provides access to values or aggregate functions over a single property (entity field).
func (*PropertyQuery) Average ¶ added in v1.5.0
func (pq *PropertyQuery) Average() (float64, error)
Average returns an average value for the given numeric property across all objects matching the query.
func (*PropertyQuery) Close ¶ added in v1.5.0
func (pq *PropertyQuery) Close() error
Close frees (native) resources held by this PropertyQuery. While SetFinalizer() is used to close automatically after GC, it's usually still preferable to close() manually after you don't need the object anymore.
func (*PropertyQuery) Count ¶ added in v1.5.0
func (pq *PropertyQuery) Count() (uint64, error)
Count returns a number of non-NULL values of the given property across all objects matching the query.
func (*PropertyQuery) Distinct ¶ added in v1.5.0
func (pq *PropertyQuery) Distinct(value bool) error
Distinct configures the property query to work only on distinct values. Note: not all methods support distinct, those that don't will return an error.
func (*PropertyQuery) DistinctString ¶ added in v1.5.0
func (pq *PropertyQuery) DistinctString(value, caseSensitive bool) error
DistinctString configures the property query to work only on distinct values. Note: not all methods support distinct, those that don't will return an error.
func (*PropertyQuery) FindBools ¶ added in v1.5.0
func (pq *PropertyQuery) FindBools(valueIfNil *bool) ([]bool, error)
FindBools returns an int8 slice composed of values of the given property across all objects matching the query. Parameter valueIfNil - value that should be returned instead of NULL values on object fields. If `valueIfNil = nil` is given, objects with NULL values of the specified field are skipped.
func (*PropertyQuery) FindFloat32s ¶ added in v1.5.0
func (pq *PropertyQuery) FindFloat32s(valueIfNil *float32) ([]float32, error)
FindFloat32s returns a float32 slice composed of values of the given property across all objects matching the query. Parameter valueIfNil - value that should be returned instead of NULL values on object fields. If `valueIfNil = nil` is given, objects with NULL values of the specified field are skipped.
func (*PropertyQuery) FindFloat64s ¶ added in v1.5.0
func (pq *PropertyQuery) FindFloat64s(valueIfNil *float64) ([]float64, error)
FindFloat64s returns a float64 slice composed of values of the given property across all objects matching the query. Parameter valueIfNil - value that should be returned instead of NULL values on object fields. If `valueIfNil = nil` is given, objects with NULL values of the specified field are skipped.
func (*PropertyQuery) FindInt16s ¶ added in v1.5.0
func (pq *PropertyQuery) FindInt16s(valueIfNil *int16) ([]int16, error)
FindInt16s returns an int16 slice composed of values of the given property across all objects matching the query. Parameter valueIfNil - value that should be returned instead of NULL values on object fields. If `valueIfNil = nil` is given, objects with NULL values of the specified field are skipped.
func (*PropertyQuery) FindInt32s ¶ added in v1.5.0
func (pq *PropertyQuery) FindInt32s(valueIfNil *int32) ([]int32, error)
FindInt32s returns an int32 slice composed of values of the given property across all objects matching the query. Parameter valueIfNil - value that should be returned instead of NULL values on object fields. If `valueIfNil = nil` is given, objects with NULL values of the specified field are skipped.
func (*PropertyQuery) FindInt64s ¶ added in v1.5.0
func (pq *PropertyQuery) FindInt64s(valueIfNil *int64) ([]int64, error)
FindInt64s returns an int64 slice composed of values of the given property across all objects matching the query. Parameter valueIfNil - value that should be returned instead of NULL values on object fields. If `valueIfNil = nil` is given, objects with NULL values of the specified field are skipped.
func (*PropertyQuery) FindInt8s ¶ added in v1.5.0
func (pq *PropertyQuery) FindInt8s(valueIfNil *int8) ([]int8, error)
FindInt8s returns an int8 slice composed of values of the given property across all objects matching the query. Parameter valueIfNil - value that should be returned instead of NULL values on object fields. If `valueIfNil = nil` is given, objects with NULL values of the specified field are skipped.
func (*PropertyQuery) FindInts ¶ added in v1.5.0
func (pq *PropertyQuery) FindInts(valueIfNil *int) ([]int, error)
FindInts returns an int slice composed of values of the given property across all objects matching the query. Parameter valueIfNil - value that should be returned instead of NULL values on object fields. If `valueIfNil = nil` is given, objects with NULL values of the specified field are skipped.
func (*PropertyQuery) FindStrings ¶ added in v1.5.0
func (pq *PropertyQuery) FindStrings(valueIfNil *string) ([]string, error)
FindStrings returns a string slice composed of values of the given property across all objects matching the query. Parameter valueIfNil - value that should be returned instead of NULL values on object fields. If `valueIfNil = nil` is given, objects with NULL values of the specified field are skipped.
func (*PropertyQuery) FindUint16s ¶ added in v1.5.0
func (pq *PropertyQuery) FindUint16s(valueIfNil *uint16) ([]uint16, error)
FindUint16s returns an uint16 slice composed of values of the given property across all objects matching the query. Parameter valueIfNil - value that should be returned instead of NULL values on object fields. If `valueIfNil = nil` is given, objects with NULL values of the specified field are skipped.
func (*PropertyQuery) FindUint32s ¶ added in v1.5.0
func (pq *PropertyQuery) FindUint32s(valueIfNil *uint32) ([]uint32, error)
FindUint32s returns an uint32 slice composed of values of the given property across all objects matching the query. Parameter valueIfNil - value that should be returned instead of NULL values on object fields. If `valueIfNil = nil` is given, objects with NULL values of the specified field are skipped.
func (*PropertyQuery) FindUint64s ¶ added in v1.5.0
func (pq *PropertyQuery) FindUint64s(valueIfNil *uint64) ([]uint64, error)
FindUint64s returns an uint64 slice composed of values of the given property across all objects matching the query. Parameter valueIfNil - value that should be returned instead of NULL values on object fields. If `valueIfNil = nil` is given, objects with NULL values of the specified field are skipped.
func (*PropertyQuery) FindUint8s ¶ added in v1.5.0
func (pq *PropertyQuery) FindUint8s(valueIfNil *uint8) ([]uint8, error)
FindUint8s returns an int8 slice composed of values of the given property across all objects matching the query. Parameter valueIfNil - value that should be returned instead of NULL values on object fields. If `valueIfNil = nil` is given, objects with NULL values of the specified field are skipped.
func (*PropertyQuery) FindUints ¶ added in v1.5.0
func (pq *PropertyQuery) FindUints(valueIfNil *uint) ([]uint, error)
FindUints returns an uint slice composed of values of the given property across all objects matching the query. Parameter valueIfNil - value that should be returned instead of NULL values on object fields. If `valueIfNil = nil` is given, objects with NULL values of the specified field are skipped.
func (*PropertyQuery) Max ¶ added in v1.5.0
func (pq *PropertyQuery) Max() (int64, error)
Max finds the maximum value of the given property across all objects matching the query.
func (*PropertyQuery) MaxFloat64 ¶ added in v1.5.0
func (pq *PropertyQuery) MaxFloat64() (float64, error)
MaxFloat64 finds the maximum value of the given floating-point property across all objects matching the query.
func (*PropertyQuery) Min ¶ added in v1.5.0
func (pq *PropertyQuery) Min() (int64, error)
Min finds the minimum value of the given property across all objects matching the query.
func (*PropertyQuery) MinFloat64 ¶ added in v1.5.0
func (pq *PropertyQuery) MinFloat64() (float64, error)
MinFloat64 finds the minimum value of the given floating-point property across all objects matching the query.
func (*PropertyQuery) Sum ¶ added in v1.5.0
func (pq *PropertyQuery) Sum() (int64, error)
Sum calculates the sum of the given property across all objects matching the query.
func (*PropertyQuery) SumFloat64 ¶ added in v1.5.0
func (pq *PropertyQuery) SumFloat64() (float64, error)
SumFloat64 calculates the sum of the given floating-point property across all objects matching the query.
type PropertyRune ¶ added in v0.8.0
type PropertyRune struct {
*BaseProperty
}
PropertyRune holds information about a property and provides query building methods
func (PropertyRune) Between ¶ added in v0.8.0
func (property PropertyRune) Between(a, b rune) Condition
Between finds entities with the stored property value between a and b (including a and b)
func (PropertyRune) Equals ¶ added in v0.8.0
func (property PropertyRune) Equals(value rune) Condition
Equals finds entities with the stored property value equal to the given value
func (PropertyRune) GreaterOrEqual ¶ added in v1.3.0
func (property PropertyRune) GreaterOrEqual(value rune) Condition
GreaterOrEqual finds entities with the stored property value greater than the given value
func (PropertyRune) GreaterThan ¶ added in v0.8.0
func (property PropertyRune) GreaterThan(value rune) Condition
GreaterThan finds entities with the stored property value greater than the given value
func (PropertyRune) In ¶ added in v0.8.0
func (property PropertyRune) In(values ...rune) Condition
In finds entities with the stored property value equal to any of the given values
func (PropertyRune) LessOrEqual ¶ added in v1.3.0
func (property PropertyRune) LessOrEqual(value rune) Condition
LessOrEqual finds entities with the stored property value less than the given value
func (PropertyRune) LessThan ¶ added in v0.8.0
func (property PropertyRune) LessThan(value rune) Condition
LessThan finds entities with the stored property value less than the given value
func (PropertyRune) NotEquals ¶ added in v0.8.0
func (property PropertyRune) NotEquals(value rune) Condition
NotEquals finds entities with the stored property value different than the given value
func (PropertyRune) NotIn ¶ added in v0.8.0
func (property PropertyRune) NotIn(values ...rune) Condition
NotIn finds entities with the stored property value not equal to any of the given values
func (PropertyRune) OrderAsc ¶ added in v1.1.0
func (property PropertyRune) OrderAsc() Condition
OrderAsc sets ascending order based on this property
func (PropertyRune) OrderDesc ¶ added in v1.1.0
func (property PropertyRune) OrderDesc() Condition
OrderDesc sets descending order based on this property
func (PropertyRune) OrderNilAsZero ¶ added in v1.1.0
func (property PropertyRune) OrderNilAsZero() Condition
OrderNilAsZero treats the nil value of the property the same as if it was 0
func (PropertyRune) OrderNilLast ¶ added in v1.1.0
func (property PropertyRune) OrderNilLast() Condition
OrderNilLast puts objects with nil value of the property at the end of the result set
type PropertyString ¶ added in v0.8.0
type PropertyString struct {
*BaseProperty
}
PropertyString holds information about a property and provides query building methods
func (PropertyString) Contains ¶ added in v0.8.0
func (property PropertyString) Contains(text string, caseSensitive bool) Condition
Contains finds entities with the stored property value contains the given text
func (PropertyString) Equals ¶ added in v0.8.0
func (property PropertyString) Equals(text string, caseSensitive bool) Condition
Equals finds entities with the stored property value equal to the given value
func (PropertyString) GreaterOrEqual ¶ added in v0.8.0
func (property PropertyString) GreaterOrEqual(text string, caseSensitive bool) Condition
GreaterOrEqual finds entities with the stored property value greater than the given value or they're equal
func (PropertyString) GreaterThan ¶ added in v0.8.0
func (property PropertyString) GreaterThan(text string, caseSensitive bool) Condition
GreaterThan finds entities with the stored property value greater than the given value
func (PropertyString) HasPrefix ¶ added in v0.8.0
func (property PropertyString) HasPrefix(text string, caseSensitive bool) Condition
HasPrefix finds entities with the stored property value starts with the given text
func (PropertyString) HasSuffix ¶ added in v0.8.0
func (property PropertyString) HasSuffix(text string, caseSensitive bool) Condition
HasSuffix finds entities with the stored property value ends with the given text
func (PropertyString) In ¶ added in v0.8.0
func (property PropertyString) In(caseSensitive bool, texts ...string) Condition
In finds entities with the stored property value equal to any of the given values In finds entities with the stored property value equal to any of the given values
func (PropertyString) LessOrEqual ¶ added in v0.8.0
func (property PropertyString) LessOrEqual(text string, caseSensitive bool) Condition
LessOrEqual finds entities with the stored property value less than the given value or they're equal
func (PropertyString) LessThan ¶ added in v0.8.0
func (property PropertyString) LessThan(text string, caseSensitive bool) Condition
LessThan finds entities with the stored property value less than the given value
func (PropertyString) NotEquals ¶ added in v0.8.0
func (property PropertyString) NotEquals(text string, caseSensitive bool) Condition
NotEquals finds entities with the stored property value different than the given value
func (PropertyString) OrderAsc ¶ added in v1.1.0
func (property PropertyString) OrderAsc(caseSensitive bool) Condition
OrderAsc sets ascending order based on this property
func (PropertyString) OrderDesc ¶ added in v1.1.0
func (property PropertyString) OrderDesc(caseSensitive bool) Condition
OrderDesc sets descending order based on this property
func (PropertyString) OrderNilLast ¶ added in v1.1.0
func (property PropertyString) OrderNilLast() Condition
OrderNilLast puts objects with nil value of the property at the end of the result set
type PropertyStringVector ¶ added in v0.9.0
type PropertyStringVector struct {
*BaseProperty
}
PropertyStringVector holds information about a property and provides query building methods
type PropertyUint ¶ added in v0.8.0
type PropertyUint struct {
*BaseProperty
}
PropertyUint holds information about a property and provides query building methods
func (PropertyUint) Between ¶ added in v0.9.0
func (property PropertyUint) Between(a, b uint) Condition
Between finds entities with the stored property value between a and b (including a and b)
func (PropertyUint) Equals ¶ added in v0.8.0
func (property PropertyUint) Equals(value uint) Condition
Equals finds entities with the stored property value equal to the given value
func (PropertyUint) GreaterOrEqual ¶ added in v1.3.0
func (property PropertyUint) GreaterOrEqual(value uint) Condition
GreaterOrEqual finds entities with the stored property value greater than the given value
func (PropertyUint) GreaterThan ¶ added in v0.9.0
func (property PropertyUint) GreaterThan(value uint) Condition
GreaterThan finds entities with the stored property value greater than the given value
func (PropertyUint) In ¶ added in v0.8.0
func (property PropertyUint) In(values ...uint) Condition
In finds entities with the stored property value equal to any of the given values
func (PropertyUint) LessOrEqual ¶ added in v1.3.0
func (property PropertyUint) LessOrEqual(value uint) Condition
LessOrEqual finds entities with the stored property value less than the given value
func (PropertyUint) LessThan ¶ added in v0.9.0
func (property PropertyUint) LessThan(value uint) Condition
LessThan finds entities with the stored property value less than the given value
func (PropertyUint) NotEquals ¶ added in v0.8.0
func (property PropertyUint) NotEquals(value uint) Condition
NotEquals finds entities with the stored property value different than the given value
func (PropertyUint) NotIn ¶ added in v0.8.0
func (property PropertyUint) NotIn(values ...uint) Condition
NotIn finds entities with the stored property value not equal to any of the given values
func (PropertyUint) OrderAsc ¶ added in v1.1.0
func (property PropertyUint) OrderAsc() Condition
OrderAsc sets ascending order based on this property
func (PropertyUint) OrderDesc ¶ added in v1.1.0
func (property PropertyUint) OrderDesc() Condition
OrderDesc sets descending order based on this property
func (PropertyUint) OrderNilAsZero ¶ added in v1.1.0
func (property PropertyUint) OrderNilAsZero() Condition
OrderNilAsZero treats the nil value of the property the same as if it was 0
func (PropertyUint) OrderNilLast ¶ added in v1.1.0
func (property PropertyUint) OrderNilLast() Condition
OrderNilLast puts objects with nil value of the property at the end of the result set
type PropertyUint16 ¶ added in v0.8.0
type PropertyUint16 struct {
*BaseProperty
}
PropertyUint16 holds information about a property and provides query building methods
func (PropertyUint16) Between ¶ added in v0.8.0
func (property PropertyUint16) Between(a, b uint16) Condition
Between finds entities with the stored property value between a and b (including a and b)
func (PropertyUint16) Equals ¶ added in v0.8.0
func (property PropertyUint16) Equals(value uint16) Condition
Equals finds entities with the stored property value equal to the given value
func (PropertyUint16) GreaterOrEqual ¶ added in v1.3.0
func (property PropertyUint16) GreaterOrEqual(value uint16) Condition
GreaterOrEqual finds entities with the stored property value greater than the given value
func (PropertyUint16) GreaterThan ¶ added in v0.8.0
func (property PropertyUint16) GreaterThan(value uint16) Condition
GreaterThan finds entities with the stored property value greater than the given value
func (PropertyUint16) LessOrEqual ¶ added in v1.3.0
func (property PropertyUint16) LessOrEqual(value uint16) Condition
LessOrEqual finds entities with the stored property value less than the given value
func (PropertyUint16) LessThan ¶ added in v0.8.0
func (property PropertyUint16) LessThan(value uint16) Condition
LessThan finds entities with the stored property value less than the given value
func (PropertyUint16) NotEquals ¶ added in v0.8.0
func (property PropertyUint16) NotEquals(value uint16) Condition
NotEquals finds entities with the stored property value different than the given value
func (PropertyUint16) OrderAsc ¶ added in v1.1.0
func (property PropertyUint16) OrderAsc() Condition
OrderAsc sets ascending order based on this property
func (PropertyUint16) OrderDesc ¶ added in v1.1.0
func (property PropertyUint16) OrderDesc() Condition
OrderDesc sets descending order based on this property
func (PropertyUint16) OrderNilAsZero ¶ added in v1.1.0
func (property PropertyUint16) OrderNilAsZero() Condition
OrderNilAsZero treats the nil value of the property the same as if it was 0
func (PropertyUint16) OrderNilLast ¶ added in v1.1.0
func (property PropertyUint16) OrderNilLast() Condition
OrderNilLast puts objects with nil value of the property at the end of the result set
type PropertyUint32 ¶ added in v0.8.0
type PropertyUint32 struct {
*BaseProperty
}
PropertyUint32 holds information about a property and provides query building methods
func (PropertyUint32) Between ¶ added in v0.8.0
func (property PropertyUint32) Between(a, b uint32) Condition
Between finds entities with the stored property value between a and b (including a and b)
func (PropertyUint32) Equals ¶ added in v0.8.0
func (property PropertyUint32) Equals(value uint32) Condition
Equals finds entities with the stored property value equal to the given value
func (PropertyUint32) GreaterOrEqual ¶ added in v1.3.0
func (property PropertyUint32) GreaterOrEqual(value uint32) Condition
GreaterOrEqual finds entities with the stored property value greater than the given value
func (PropertyUint32) GreaterThan ¶ added in v0.8.0
func (property PropertyUint32) GreaterThan(value uint32) Condition
GreaterThan finds entities with the stored property value greater than the given value
func (PropertyUint32) In ¶ added in v0.8.0
func (property PropertyUint32) In(values ...uint32) Condition
In finds entities with the stored property value equal to any of the given values
func (PropertyUint32) LessOrEqual ¶ added in v1.3.0
func (property PropertyUint32) LessOrEqual(value uint32) Condition
LessOrEqual finds entities with the stored property value less than the given value
func (PropertyUint32) LessThan ¶ added in v0.8.0
func (property PropertyUint32) LessThan(value uint32) Condition
LessThan finds entities with the stored property value less than the given value
func (PropertyUint32) NotEquals ¶ added in v0.8.0
func (property PropertyUint32) NotEquals(value uint32) Condition
NotEquals finds entities with the stored property value different than the given value
func (PropertyUint32) NotIn ¶ added in v0.8.0
func (property PropertyUint32) NotIn(values ...uint32) Condition
NotIn finds entities with the stored property value not equal to any of the given values
func (PropertyUint32) OrderAsc ¶ added in v1.1.0
func (property PropertyUint32) OrderAsc() Condition
OrderAsc sets ascending order based on this property
func (PropertyUint32) OrderDesc ¶ added in v1.1.0
func (property PropertyUint32) OrderDesc() Condition
OrderDesc sets descending order based on this property
func (PropertyUint32) OrderNilAsZero ¶ added in v1.1.0
func (property PropertyUint32) OrderNilAsZero() Condition
OrderNilAsZero treats the nil value of the property the same as if it was 0
func (PropertyUint32) OrderNilLast ¶ added in v1.1.0
func (property PropertyUint32) OrderNilLast() Condition
OrderNilLast puts objects with nil value of the property at the end of the result set
type PropertyUint64 ¶ added in v0.8.0
type PropertyUint64 struct {
*BaseProperty
}
PropertyUint64 holds information about a property and provides query building methods
func (PropertyUint64) Between ¶ added in v0.9.0
func (property PropertyUint64) Between(a, b uint64) Condition
Between finds entities with the stored property value between a and b (including a and b)
func (PropertyUint64) Equals ¶ added in v0.8.0
func (property PropertyUint64) Equals(value uint64) Condition
Equals finds entities with the stored property value equal to the given value
func (PropertyUint64) GreaterOrEqual ¶ added in v1.3.0
func (property PropertyUint64) GreaterOrEqual(value uint64) Condition
GreaterOrEqual finds entities with the stored property value greater than the given value or they're equal
func (PropertyUint64) GreaterThan ¶ added in v0.9.0
func (property PropertyUint64) GreaterThan(value uint64) Condition
GreaterThan finds entities with the stored property value greater than the given value
func (PropertyUint64) In ¶ added in v0.8.0
func (property PropertyUint64) In(values ...uint64) Condition
In finds entities with the stored property value equal to any of the given values
func (PropertyUint64) LessOrEqual ¶ added in v1.3.0
func (property PropertyUint64) LessOrEqual(value uint64) Condition
LessOrEqual finds entities with the stored property value less than the given value or they're equal
func (PropertyUint64) LessThan ¶ added in v0.9.0
func (property PropertyUint64) LessThan(value uint64) Condition
LessThan finds entities with the stored property value less than the given value
func (PropertyUint64) NotEquals ¶ added in v0.8.0
func (property PropertyUint64) NotEquals(value uint64) Condition
NotEquals finds entities with the stored property value different than the given value
func (PropertyUint64) NotIn ¶ added in v0.8.0
func (property PropertyUint64) NotIn(values ...uint64) Condition
NotIn finds entities with the stored property value not equal to any of the given values
func (PropertyUint64) OrderAsc ¶ added in v1.1.0
func (property PropertyUint64) OrderAsc() Condition
OrderAsc sets ascending order based on this property
func (PropertyUint64) OrderDesc ¶ added in v1.1.0
func (property PropertyUint64) OrderDesc() Condition
OrderDesc sets descending order based on this property
func (PropertyUint64) OrderNilAsZero ¶ added in v1.1.0
func (property PropertyUint64) OrderNilAsZero() Condition
OrderNilAsZero treats the nil value of the property the same as if it was 0
func (PropertyUint64) OrderNilLast ¶ added in v1.1.0
func (property PropertyUint64) OrderNilLast() Condition
OrderNilLast puts objects with nil value of the property at the end of the result set
type PropertyUint8 ¶ added in v0.8.0
type PropertyUint8 struct {
*BaseProperty
}
PropertyUint8 holds information about a property and provides query building methods
func (PropertyUint8) Between ¶ added in v0.8.0
func (property PropertyUint8) Between(a, b uint8) Condition
Between finds entities with the stored property value between a and b (including a and b)
func (PropertyUint8) Equals ¶ added in v0.8.0
func (property PropertyUint8) Equals(value uint8) Condition
Equals finds entities with the stored property value equal to the given value
func (PropertyUint8) GreaterOrEqual ¶ added in v1.3.0
func (property PropertyUint8) GreaterOrEqual(value uint8) Condition
GreaterOrEqual finds entities with the stored property value greater than the given value
func (PropertyUint8) GreaterThan ¶ added in v0.8.0
func (property PropertyUint8) GreaterThan(value uint8) Condition
GreaterThan finds entities with the stored property value greater than the given value
func (PropertyUint8) LessOrEqual ¶ added in v1.3.0
func (property PropertyUint8) LessOrEqual(value uint8) Condition
LessOrEqual finds entities with the stored property value less than the given value
func (PropertyUint8) LessThan ¶ added in v0.8.0
func (property PropertyUint8) LessThan(value uint8) Condition
LessThan finds entities with the stored property value less than the given value
func (PropertyUint8) NotEquals ¶ added in v0.8.0
func (property PropertyUint8) NotEquals(value uint8) Condition
NotEquals finds entities with the stored property value different than the given value
func (PropertyUint8) OrderAsc ¶ added in v1.1.0
func (property PropertyUint8) OrderAsc() Condition
OrderAsc sets ascending order based on this property
func (PropertyUint8) OrderDesc ¶ added in v1.1.0
func (property PropertyUint8) OrderDesc() Condition
OrderDesc sets descending order based on this property
func (PropertyUint8) OrderNilAsZero ¶ added in v1.1.0
func (property PropertyUint8) OrderNilAsZero() Condition
OrderNilAsZero treats the nil value of the property the same as if it was 0
func (PropertyUint8) OrderNilLast ¶ added in v1.1.0
func (property PropertyUint8) OrderNilLast() Condition
OrderNilLast puts objects with nil value of the property at the end of the result set
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
A Query allows to search for objects matching user defined conditions.
For example, you can find all people whose last name starts with an 'N':
box.Query(Person_.LastName.HasPrefix("N", false)).Find()
Note that Person_ is a struct generated by ObjectBox allowing to conveniently reference properties.
func (*Query) Close ¶
Close frees (native) resources held by this Query. Note that this is optional and not required because the GC invokes a finalizer automatically.
func (*Query) Count ¶ added in v0.8.0
Count returns the number of objects matching the query. Currently can't be used in combination with Offset().
func (*Query) DescribeParams ¶ added in v0.9.0
DescribeParams returns a string representation of the query conditions
func (*Query) Offset ¶ added in v0.9.0
Offset defines the index of the first object to process (how many objects to skip)
func (*Query) Property ¶ added in v1.5.0
func (query *Query) Property(prop Property) *PropertyQuery
Property provides a way to access a value of a single property or run aggregate functions. Note: this method panics in case a property query could not be created, e.g. property doesn't belong to the queried entity. Consider using PropertyOrError if you need an explicit error check, e.g. when using dynamic arguments.
func (*Query) PropertyOrError ¶ added in v1.5.0
func (query *Query) PropertyOrError(prop Property) (*PropertyQuery, error)
PropertyOrError is just like Property except it returns a potential error instead of issuing a panic.
func (*Query) Remove ¶ added in v0.8.0
Remove permanently deletes all objects matching the query from the database. Currently can't be used in combination with Offset() or Limit().
func (*Query) SetBytesParams ¶ added in v0.9.0
SetBytesParams changes query parameter values on the given property
func (*Query) SetFloat64Params ¶ added in v0.9.0
SetFloat64Params changes query parameter values on the given property
func (*Query) SetInt32ParamsIn ¶ added in v0.9.0
SetInt32ParamsIn changes query parameter values on the given property
func (*Query) SetInt64Params ¶ added in v0.9.0
SetInt64Params changes query parameter values on the given property
func (*Query) SetInt64ParamsIn ¶ added in v0.9.0
SetInt64ParamsIn changes query parameter values on the given property
func (*Query) SetStringParams ¶ added in v0.9.0
SetStringParams changes query parameter values on the given property
func (*Query) SetStringParamsIn ¶ added in v0.9.0
SetStringParamsIn changes query parameter values on the given property
type QueryBuilder ¶
type QueryBuilder struct { // The first error that occurred during a any of the calls on the query builder Err error // contains filtered or unexported fields }
QueryBuilder is an internal class; use Box.Query instead. Allows construction of queries; just check queryBuilder.Error or err from Build()
func (*QueryBuilder) Alias ¶ added in v1.1.0
func (qb *QueryBuilder) Alias(alias string) error
Alias sets an alias for the last created condition
func (*QueryBuilder) All ¶ added in v0.9.0
func (qb *QueryBuilder) All(ids []ConditionId) (ConditionId, error)
All is called internally
func (*QueryBuilder) Any ¶ added in v0.9.0
func (qb *QueryBuilder) Any(ids []ConditionId) (ConditionId, error)
Any is called internally
func (*QueryBuilder) Build ¶
func (qb *QueryBuilder) Build(box *Box) (*Query, error)
Build is called internally
func (*QueryBuilder) BytesEqual ¶ added in v0.7.0
func (qb *QueryBuilder) BytesEqual(property *BaseProperty, value []byte) (ConditionId, error)
BytesEqual is called internally
func (*QueryBuilder) BytesGreater ¶ added in v0.7.0
func (qb *QueryBuilder) BytesGreater(property *BaseProperty, value []byte, withEqual bool) (ConditionId, error)
BytesGreater is called internally
func (*QueryBuilder) BytesLess ¶ added in v0.7.0
func (qb *QueryBuilder) BytesLess(property *BaseProperty, value []byte, withEqual bool) (ConditionId, error)
BytesLess is called internally
func (*QueryBuilder) DoubleBetween ¶ added in v0.7.0
func (qb *QueryBuilder) DoubleBetween(property *BaseProperty, valueA float64, valueB float64) (ConditionId, error)
DoubleBetween is called internally
func (*QueryBuilder) DoubleGreater ¶ added in v0.7.0
func (qb *QueryBuilder) DoubleGreater(property *BaseProperty, value float64, withEqual bool) (ConditionId, error)
DoubleGreater is called internally
func (*QueryBuilder) DoubleLess ¶ added in v0.7.0
func (qb *QueryBuilder) DoubleLess(property *BaseProperty, value float64, withEqual bool) (ConditionId, error)
DoubleLess is called internally
func (*QueryBuilder) Int32In ¶ added in v0.7.0
func (qb *QueryBuilder) Int32In(property *BaseProperty, values []int32) (ConditionId, error)
Int32In is called internally
func (*QueryBuilder) Int32NotIn ¶ added in v0.7.0
func (qb *QueryBuilder) Int32NotIn(property *BaseProperty, values []int32) (ConditionId, error)
Int32NotIn is called internally
func (*QueryBuilder) Int64In ¶ added in v0.7.0
func (qb *QueryBuilder) Int64In(property *BaseProperty, values []int64) (ConditionId, error)
Int64In is called internally
func (*QueryBuilder) Int64NotIn ¶ added in v0.7.0
func (qb *QueryBuilder) Int64NotIn(property *BaseProperty, values []int64) (ConditionId, error)
Int64NotIn is called internally
func (*QueryBuilder) IntBetween ¶
func (qb *QueryBuilder) IntBetween(property *BaseProperty, value1 int64, value2 int64) (ConditionId, error)
IntBetween is called internally
func (*QueryBuilder) IntEqual ¶ added in v0.7.0
func (qb *QueryBuilder) IntEqual(property *BaseProperty, value int64) (ConditionId, error)
IntEqual is called internally
func (*QueryBuilder) IntGreater ¶ added in v0.7.0
func (qb *QueryBuilder) IntGreater(property *BaseProperty, value int64, withEqual bool) (ConditionId, error)
IntGreater is called internally
func (*QueryBuilder) IntLess ¶ added in v0.7.0
func (qb *QueryBuilder) IntLess(property *BaseProperty, value int64, withEqual bool) (ConditionId, error)
IntLess is called internally
func (*QueryBuilder) IntNotEqual ¶ added in v0.7.0
func (qb *QueryBuilder) IntNotEqual(property *BaseProperty, value int64) (ConditionId, error)
IntNotEqual is called internally
func (*QueryBuilder) IsNil ¶ added in v1.0.0
func (qb *QueryBuilder) IsNil(property *BaseProperty) (ConditionId, error)
IsNil is called internally
func (*QueryBuilder) IsNotNil ¶ added in v1.0.0
func (qb *QueryBuilder) IsNotNil(property *BaseProperty) (ConditionId, error)
IsNotNil is called internally
func (*QueryBuilder) LinkManyToMany ¶ added in v0.9.0
func (qb *QueryBuilder) LinkManyToMany(relation *RelationToMany, conditions []Condition) error
LinkManyToMany is called internally
func (*QueryBuilder) LinkOneToMany ¶ added in v0.9.0
func (qb *QueryBuilder) LinkOneToMany(relation *RelationToOne, conditions []Condition) error
LinkOneToMany is called internally
func (*QueryBuilder) StringContains ¶ added in v0.7.0
func (qb *QueryBuilder) StringContains(property *BaseProperty, value string, caseSensitive bool) (ConditionId, error)
StringContains is called internally
func (*QueryBuilder) StringEquals ¶ added in v0.8.0
func (qb *QueryBuilder) StringEquals(property *BaseProperty, value string, caseSensitive bool) (ConditionId, error)
StringEquals is called internally
func (*QueryBuilder) StringGreater ¶ added in v0.7.0
func (qb *QueryBuilder) StringGreater(property *BaseProperty, value string, caseSensitive bool, withEqual bool) (ConditionId, error)
StringGreater is called internally
func (*QueryBuilder) StringHasPrefix ¶ added in v0.8.0
func (qb *QueryBuilder) StringHasPrefix(property *BaseProperty, value string, caseSensitive bool) (ConditionId, error)
StringHasPrefix is called internally
func (*QueryBuilder) StringHasSuffix ¶ added in v0.8.0
func (qb *QueryBuilder) StringHasSuffix(property *BaseProperty, value string, caseSensitive bool) (ConditionId, error)
StringHasSuffix is called internally
func (*QueryBuilder) StringIn ¶ added in v0.7.0
func (qb *QueryBuilder) StringIn(property *BaseProperty, values []string, caseSensitive bool) (ConditionId, error)
StringIn is called internally
func (*QueryBuilder) StringLess ¶ added in v0.7.0
func (qb *QueryBuilder) StringLess(property *BaseProperty, value string, caseSensitive bool, withEqual bool) (ConditionId, error)
StringLess is called internally
func (*QueryBuilder) StringNotEquals ¶ added in v0.8.0
func (qb *QueryBuilder) StringNotEquals(property *BaseProperty, value string, caseSensitive bool) (ConditionId, error)
StringNotEquals is called internally
func (*QueryBuilder) StringVectorContains ¶ added in v0.9.0
func (qb *QueryBuilder) StringVectorContains(property *BaseProperty, value string, caseSensitive bool) (ConditionId, error)
StringVectorContains is called internally
type RelationToMany ¶ added in v0.9.0
RelationToMany holds information about a standalone relation link between two entities. It is used in generated entity code, providing a way to create a query across multiple related entities. Internally, the relation is stored separately, holding pairs of source & target object IDs.
func (*RelationToMany) Link ¶ added in v0.9.0
func (relation *RelationToMany) Link(conditions ...Condition) Condition
Link creates a connection and takes inner conditions to evaluate on the linked entity.
type RelationToOne ¶ added in v0.9.0
type RelationToOne struct { Property *BaseProperty Target *Entity }
RelationToOne holds information about a relation link on a property. It is used in generated entity code, providing a way to create a query across multiple related entities. Internally, the property value holds an ID of an object in the target entity.
func (RelationToOne) Equals ¶ added in v0.9.0
func (relation RelationToOne) Equals(value uint64) Condition
Equals finds entities with relation target ID equal to the given value
func (RelationToOne) In ¶ added in v0.9.0
func (relation RelationToOne) In(values ...uint64) Condition
In finds entities with relation target ID equal to any of the given values
func (*RelationToOne) Link ¶ added in v0.9.0
func (relation *RelationToOne) Link(conditions ...Condition) Condition
Link creates a connection and takes inner conditions to evaluate on the linked entity.
func (RelationToOne) NotEquals ¶ added in v0.9.0
func (relation RelationToOne) NotEquals(value uint64) Condition
NotEquals finds entities with relation target ID different than the given value
func (RelationToOne) NotIn ¶ added in v0.9.0
func (relation RelationToOne) NotIn(values ...uint64) Condition
NotIn finds entities with relation target ID not equal to any the given values
type SyncChange ¶ added in v1.3.0
SyncChange describes a single incoming data event received by the sync client
type SyncClient ¶ added in v1.3.0
type SyncClient struct {
// contains filtered or unexported fields
}
SyncClient is used to connect to an ObjectBox sync server.
func NewSyncClient ¶ added in v1.3.0
func NewSyncClient(ob *ObjectBox, serverUri string, credentials *SyncCredentials) (*SyncClient, error)
NewSyncClient creates a sync client associated with the given store and configures it with the given options. This does not initiate any connection attempts yet, call SyncClient.Start() to do so.
Before SyncClient.Start(), you can still configure some aspects, e.g. SyncClient.SetRequestUpdatesMode().
func (*SyncClient) CancelUpdates ¶ added in v1.3.0
func (client *SyncClient) CancelUpdates() error
CancelUpdates can be used to unsubscribe from manually requested updates (see `RequestUpdates(true)`).
func (*SyncClient) Close ¶ added in v1.3.0
func (client *SyncClient) Close() error
Close stops synchronization and frees the resources.
func (*SyncClient) IsClosed ¶ added in v1.3.0
func (client *SyncClient) IsClosed() bool
IsClosed returns true if this sync client is closed and can no longer be used.
func (*SyncClient) RequestUpdates ¶ added in v1.3.0
func (client *SyncClient) RequestUpdates(alsoSubscribe bool) error
RequestUpdates can be used to manually synchronize incoming changes in case the client is running in "Manual" or "AutoNoPushes" mode (i.e. it doesn't get the updates automatically). Additionally, it can be used to subscribe for future pushes (similar to the "Auto" mode).
func (*SyncClient) SetChangeListener ¶ added in v1.3.0
func (client *SyncClient) SetChangeListener(callback syncChangeListener) error
SetChangeListener sets or overrides a previously set listener for incoming changes notifications. SyncChange event is issued after a transaction is applied to the local database.
func (*SyncClient) SetCompletionListener ¶ added in v1.3.0
func (client *SyncClient) SetCompletionListener(callback syncCompletionListener) error
SetCompletionListener sets or overrides a previously set listener for a "login" event.
func (*SyncClient) SetConnectionListener ¶ added in v1.3.0
func (client *SyncClient) SetConnectionListener(callback syncConnectionListener) error
SetConnectionListener sets or overrides a previously set listener for a "connection" event.
func (*SyncClient) SetCredentials ¶ added in v1.3.0
func (client *SyncClient) SetCredentials(credentials *SyncCredentials) error
SetCredentials configures authentication credentials, depending on your server config.
func (*SyncClient) SetDisconnectionListener ¶ added in v1.3.0
func (client *SyncClient) SetDisconnectionListener(callback syncDisconnectionListener) error
SetDisconnectionListener sets or overrides a previously set listener for a "disconnection" event.
func (*SyncClient) SetLoginFailureListener ¶ added in v1.3.0
func (client *SyncClient) SetLoginFailureListener(callback syncLoginFailureListener) error
SetLoginFailureListener sets or overrides a previously set listener for a "login" event.
func (*SyncClient) SetLoginListener ¶ added in v1.3.0
func (client *SyncClient) SetLoginListener(callback syncLoginListener) error
SetLoginListener sets or overrides a previously set listener for a "login" event.
func (*SyncClient) SetRequestUpdatesMode ¶ added in v1.3.0
func (client *SyncClient) SetRequestUpdatesMode(mode syncRequestUpdatesMode) error
SetRequestUpdatesMode configures how/when the server will send the changes to us (the client). Can only be called before Start(). See SyncRequestUpdatesManual, SyncRequestUpdatesAutomatic, SyncRequestUpdatesAutoNoPushes.
func (*SyncClient) SetServerTimeListener ¶ added in v1.3.0
func (client *SyncClient) SetServerTimeListener(callback syncTimeListener) error
SetServerTimeListener sets or overrides a previously set listener for a "login" event.
func (*SyncClient) Start ¶ added in v1.3.0
func (client *SyncClient) Start() error
Start initiates the connection to the server and begins the synchronization
func (*SyncClient) State ¶ added in v1.3.0
func (client *SyncClient) State() SyncClientState
State returns the current state of the sync client
func (*SyncClient) Stop ¶ added in v1.3.0
func (client *SyncClient) Stop() error
Stop stops the synchronization and closes the connection to the server Does nothing if it is already stopped.
func (*SyncClient) WaitForLogin ¶ added in v1.3.0
func (client *SyncClient) WaitForLogin(timeout time.Duration) (successful bool, err error)
WaitForLogin - waits for the sync client to get into the given state or until the given timeout is reached. For an asynchronous alternative, please check the listeners. Start() is called automatically if it hasn't been yet. Returns:
(true, nil) in case the login was successful; (false, nil) in case of a time out; (false, error) if an error occurred (such as wrong credentials)
type SyncClientState ¶ added in v1.3.0
type SyncClientState uint
const ( // SyncClientStateCreated means the sync client has just been created SyncClientStateCreated SyncClientState = C.OBXSyncState_CREATED // SyncClientStateStarted means the sync client has been started (using start() method) SyncClientStateStarted SyncClientState = C.OBXSyncState_STARTED // SyncClientStateConnected means the sync client has a connection to the server (not logged in yet) SyncClientStateConnected SyncClientState = C.OBXSyncState_CONNECTED // SyncClientStateLoggedIn means the sync client has successfully logged in to the server SyncClientStateLoggedIn SyncClientState = C.OBXSyncState_LOGGED_IN // SyncClientStateDisconnected means the sync client has lost/closed the connection to the server SyncClientStateDisconnected SyncClientState = C.OBXSyncState_DISCONNECTED // SyncClientStateStopped means the sync client has stopped synchronization SyncClientStateStopped SyncClientState = C.OBXSyncState_STOPPED // SyncClientStateDead means the sync client is in an unrecoverable state SyncClientStateDead SyncClientState = C.OBXSyncState_DEAD )
type SyncCredentials ¶ added in v1.3.0
type SyncCredentials struct {
// contains filtered or unexported fields
}
SyncCredentials are used to authenticate a sync client against a server.
func SyncCredentialsGoogleAuth ¶ added in v1.3.0
func SyncCredentialsGoogleAuth(data []byte) *SyncCredentials
SyncCredentialsGoogleAuth - Google authentication
func SyncCredentialsNone ¶ added in v1.3.0
func SyncCredentialsNone() *SyncCredentials
SyncCredentialsNone - no credentials - usually only for development, with a server configured to accept all connections without authentication.
func SyncCredentialsSharedSecret ¶ added in v1.3.0
func SyncCredentialsSharedSecret(data []byte) *SyncCredentials
SyncCredentialsSharedSecret - shared secret authentication
type SyncLoginFailure ¶ added in v1.3.0
type SyncLoginFailure uint64 // TODO enumerate possible values
type TypeId ¶
type TypeId uint32
TypeId is a type of an internal ID on model/property/relation/index
type Version ¶ added in v0.8.0
Version represents a semantic-version If you depend on a certain version of ObjectBox, you can check using this struct. See also VersionGo() and VersionLib().
func VersionGo ¶ added in v0.8.0
func VersionGo() Version
VersionGo returns the Version of the ObjectBox-Go binding
func VersionLib ¶ added in v0.8.0
func VersionLib() Version
VersionLib returns the Version of the dynamic linked ObjectBox library (loaded at runtime)
func VersionLibMin ¶ added in v1.6.1
func VersionLibMin() Version
VersionLibMin returns the minimum Version of the dynamic linked ObjectBox library that is compatible with this Go version
func VersionLibMinRecommended ¶ added in v1.6.1
func VersionLibMinRecommended() Version
VersionLibMinRecommended returns the minimum recommended Version of the dynamic linked ObjectBox library. This version not only considers compatibility with this Go version, but also known issues older (compatible) versions. It is guaranteed to be at least VersionLibMin()
func VersionLibStatic ¶ added in v1.6.1
func VersionLibStatic() Version
VersionLibStatic returns the Version of ObjectBox library this Go version was compiled against (build time); see VersionLib() for the actually loaded version. This version is at least VersionLibMinRecommended().