objectbox

package
Version: v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: Apache-2.0 Imports: 12 Imported by: 2

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

View Source
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
)
View Source
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

func Alias(value string) *alias

Alias wraps a string as an identifier usable for Query.Set*Params*() methods.

func NanoTimeInt64ConvertToDatabaseValue

func NanoTimeInt64ConvertToDatabaseValue(goValue time.Time) (int64, error)

NanoTimeInt64ConvertToDatabaseValue converts time.Time to Unix timestamp in nanoseconds (internal format expected by ObjectBox on a date-nano field)

func NanoTimeInt64ConvertToEntityProperty

func NanoTimeInt64ConvertToEntityProperty(dbValue int64) (time.Time, error)

NanoTimeInt64ConvertToEntityProperty converts Unix timestamp in nanoseconds (ObjectBox date-nano field) to time.Time

func StringIdConvertToDatabaseValue

func StringIdConvertToDatabaseValue(goValue string) (uint64, error)

StringIdConvertToDatabaseValue implements "StringIdConvert" property value converter

func StringIdConvertToEntityProperty

func StringIdConvertToEntityProperty(dbValue uint64) (string, error)

StringIdConvertToEntityProperty implements "StringIdConvert" property value converter

func SyncIsAvailable

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

func TimeBinaryConvertToDatabaseValue(goValue time.Time) ([]byte, error)

TimeBinaryConvertToDatabaseValue uses time.Time.MarshalBinary() to encode time.Time.

func TimeBinaryConvertToEntityProperty

func TimeBinaryConvertToEntityProperty(dbValue []byte) (goValue time.Time, err error)

TimeBinaryConvertToEntityProperty uses time.Time.UnmarshalBinary() to decode time.Time.

func TimeInt64ConvertToDatabaseValue

func TimeInt64ConvertToDatabaseValue(goValue time.Time) (int64, error)

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

func TimeInt64ConvertToEntityProperty(dbValue int64) (time.Time, error)

TimeInt64ConvertToEntityProperty converts Unix timestamp in milliseconds (ObjectBox date field) to time.Time NOTE - you lose precision - anything smaller then milliseconds is dropped

func TimeTextConvertToDatabaseValue

func TimeTextConvertToDatabaseValue(goValue time.Time) (string, error)

TimeTextConvertToDatabaseValue uses time.Time.MarshalText() to encode time.Time into RFC 3339 formatted string.

func TimeTextConvertToEntityProperty

func TimeTextConvertToEntityProperty(dbValue string) (goValue time.Time, err error)

TimeTextConvertToEntityProperty uses time.Time.UnmarshalText() to decode RFC 3339 formatted string to time.Time.

func VersionInfo

func VersionInfo() string

VersionInfo returns a printable version string

Types

type AsyncBox

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

func NewAsyncBox(ob *ObjectBox, entityId TypeId, timeoutMs uint64) (*AsyncBox, error)

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

func (async *AsyncBox) AwaitCompletion() error

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

func (async *AsyncBox) AwaitSubmitted() error

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

func (async *AsyncBox) Close() error

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

func (async *AsyncBox) Insert(object interface{}) (id uint64, err error)

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

func (async *AsyncBox) Put(object interface{}) (id uint64, err error)

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.

func (*AsyncBox) Remove

func (async *AsyncBox) Remove(object interface{}) error

Remove deletes a single object asynchronously.

func (*AsyncBox) RemoveId

func (async *AsyncBox) RemoveId(id uint64) error

RemoveId deletes a single object asynchronously.

func (*AsyncBox) Update

func (async *AsyncBox) Update(object interface{}) error

Update a single object asynchronously. The object must already exists or the update fails silently (without an error returned).

type BaseProperty

type BaseProperty struct {
	Id     TypeId
	Entity *Entity
}

BaseProperty serves as a common base for all the property types

func (BaseProperty) IsNil

func (property BaseProperty) IsNil() Condition

IsNil finds entities with the stored property value nil

func (BaseProperty) IsNotNil

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

func (box *Box) Async() *AsyncBox

Async provides access to the default Async Box for asynchronous operations. See AsyncBox for more information.

func (*Box) Contains

func (box *Box) Contains(id uint64) (bool, error)

Contains checks whether an object with the given ID is stored.

func (*Box) ContainsIds

func (box *Box) ContainsIds(ids ...uint64) (bool, error)

ContainsIds checks whether all of the given objects are stored in DB.

func (*Box) Count

func (box *Box) Count() (uint64, error)

Count returns a number of objects stored

func (*Box) CountMax

func (box *Box) CountMax(limit uint64) (uint64, error)

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

func (box *Box) Get(id uint64) (object interface{}, err error)

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

func (box *Box) GetAll() (slice interface{}, err error)

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

func (box *Box) GetMany(ids ...uint64) (slice interface{}, err error)

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

func (box *Box) GetManyExisting(ids ...uint64) (slice interface{}, err error)

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

func (box *Box) Insert(object interface{}) (id uint64, err error)

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

func (box *Box) IsEmpty() (bool, error)

IsEmpty checks whether the box contains any objects

func (*Box) Put

func (box *Box) Put(object interface{}) (id uint64, err error)

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 deprecated

This method has been deprecated.
func (box *Box) PutAsync(object interface{}) (id uint64, err error)

PutAsync asynchronously inserts/updates a single object. Deprecated: use box.Async().Put() instead

func (*Box) PutMany

func (box *Box) PutMany(objects interface{}) (ids []uint64, err error)

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

func (box *Box) Query(conditions ...Condition) *Query

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

func (box *Box) QueryOrError(conditions ...Condition) (query *Query, err error)

QueryOrError is like Query() but with error handling; e.g. when you build conditions dynamically that may fail.

func (*Box) RelationIds

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

func (box *Box) RelationPut(relation *RelationToMany, sourceId, targetId uint64) error

RelationPut creates a relation between the given source & target objects

func (*Box) RelationRemove

func (box *Box) RelationRemove(relation *RelationToMany, sourceId, targetId uint64) error

RelationRemove removes a relation between the given source & target objects

func (*Box) RelationReplace

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

func (box *Box) Remove(object interface{}) error

Remove deletes a single object

func (*Box) RemoveAll

func (box *Box) RemoveAll() error

RemoveAll removes all stored objects. This is much faster than removing objects one by one in a loop.

func (*Box) RemoveId

func (box *Box) RemoveId(id uint64) error

RemoveId deletes a single object

func (*Box) RemoveIds

func (box *Box) RemoveIds(ids ...uint64) (uint64, error)

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.

func (*Box) Update

func (box *Box) Update(object interface{}) error

Update synchronously updates a single object. As opposed to Put, Update will fail if an object with the same ID is not found in the database.

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

func (builder *Builder) Build() (*ObjectBox, error)

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

func (builder *Builder) BuildOrError() (*ObjectBox, error)

BuildOrError validates the configuration and tries to init the ObjectBox.

func (*Builder) Directory

func (builder *Builder) Directory(path string) *Builder

Directory configures the path where the database is stored

func (*Builder) MaxReaders

func (builder *Builder) MaxReaders(maxReaders uint) *Builder

MaxReaders defines maximum concurrent readers (default: 126). Increase only if you are getting errors (highly concurrent scenarios).

func (*Builder) MaxSizeInKb

func (builder *Builder) MaxSizeInKb(maxSizeInKb uint64) *Builder

MaxSizeInKb defines maximum size the database can take on disk (default: 1 GByte).

func (*Builder) Model

func (builder *Builder) Model(model *Model) *Builder

Model specifies schema for the database.

Pass the result of the generated function ObjectBoxModel as an argument: Model(ObjectBoxModel())

type Condition

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

func All

func All(conditions ...Condition) Condition

All provides a way to combine multiple query conditions (equivalent to AND logical operator)

func Any

func Any(conditions ...Condition) Condition

Any provides a way to combine multiple query conditions (equivalent to OR logical operator)

type ConditionId

type ConditionId = int32

ConditionId is a condition identifier type, used when building queries

type Entity

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 NewModel

func NewModel() *Model

NewModel creates a model

func (*Model) Entity

func (model *Model) Entity(name string, id TypeId, uid uint64)

Entity creates an entity in a model

func (*Model) EntityFlags

func (model *Model) EntityFlags(entityFlags int)

EntityFlags configures behavior of entities

func (*Model) EntityLastPropertyId

func (model *Model) EntityLastPropertyId(id TypeId, uid uint64)

EntityLastPropertyId declares a property with the highest ID. Used as a compatibility check when opening DB with an older model version.

func (*Model) GeneratorVersion

func (model *Model) GeneratorVersion(version int)

GeneratorVersion configures version of the generator used to create this model

func (*Model) LastEntityId

func (model *Model) LastEntityId(id TypeId, uid uint64)

LastEntityId declares an entity with the highest ID. Used as a compatibility check when opening DB with an older model version.

func (*Model) LastIndexId

func (model *Model) LastIndexId(id TypeId, uid uint64)

LastIndexId declares an index with the highest ID. Used as a compatibility check when opening DB with an older model version.

func (*Model) LastRelationId

func (model *Model) LastRelationId(id TypeId, uid uint64)

LastRelationId declares a relation with the highest ID. Used as a compatibility check when opening DB with an older model version.

func (*Model) Property

func (model *Model) Property(name string, propertyType int, id TypeId, uid uint64)

Property creates a property in an Entity

func (*Model) PropertyFlags

func (model *Model) PropertyFlags(propertyFlags int)

PropertyFlags configures type and other information about the property

func (*Model) PropertyIndex

func (model *Model) PropertyIndex(id TypeId, uid uint64)

PropertyIndex creates a new index on the property

func (*Model) PropertyRelation

func (model *Model) PropertyRelation(targetEntityName string, indexId TypeId, indexUid uint64)

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.

func (*Model) Relation

func (model *Model) Relation(relationId TypeId, relationUid uint64, targetEntityId TypeId, targetEntityUid uint64)

Relation adds a "standalone" many-to-many relation between the current entity and a target entity

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

func (ob *ObjectBox) AwaitAsyncCompletion() error

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

func (ob *ObjectBox) InternalBox(entityId TypeId) *Box

InternalBox returns an Entity Box or panics on error (in case entity with the given ID doesn't exist)

func (*ObjectBox) RunInReadTx

func (ob *ObjectBox) RunInReadTx(fn func() error) error

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

func (ob *ObjectBox) RunInWriteTx(fn func() error) error

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

func (ob *ObjectBox) SetDebugFlags(flags uint) error

SetDebugFlags configures debug logging of the ObjectBox core. See DebugFlags* constants

func (*ObjectBox) SyncClient

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 PropertyBool

type PropertyBool struct {
	*BaseProperty
}

PropertyBool holds information about a property and provides query building methods

func (PropertyBool) Equals

func (property PropertyBool) Equals(value bool) Condition

Equals finds entities with the stored property value equal to the given value

func (PropertyBool) OrderAsc

func (property PropertyBool) OrderAsc() Condition

OrderAsc sets ascending order based on this property

func (PropertyBool) OrderDesc

func (property PropertyBool) OrderDesc() Condition

OrderDesc sets descending order based on this property

func (PropertyBool) OrderNilAsFalse

func (property PropertyBool) OrderNilAsFalse() Condition

OrderNilAsFalse treats the nil value of the property the same as if it was 0

func (PropertyBool) OrderNilLast

func (property PropertyBool) OrderNilLast() Condition

OrderNilLast puts objects with nil value of the property at the end of the result set

type PropertyByte

type PropertyByte struct {
	*BaseProperty
}

PropertyByte holds information about a property and provides query building methods

func (PropertyByte) Between

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

func (property PropertyByte) Equals(value byte) Condition

Equals finds entities with the stored property value equal to the given value

func (PropertyByte) GreaterOrEqual

func (property PropertyByte) GreaterOrEqual(value byte) Condition

GreaterOrEqual finds entities with the stored property value greater than the given value

func (PropertyByte) GreaterThan

func (property PropertyByte) GreaterThan(value byte) Condition

GreaterThan finds entities with the stored property value greater than the given value

func (PropertyByte) LessOrEqual

func (property PropertyByte) LessOrEqual(value byte) Condition

LessOrEqual finds entities with the stored property value less than the given value

func (PropertyByte) LessThan

func (property PropertyByte) LessThan(value byte) Condition

LessThan finds entities with the stored property value less than the given value

func (PropertyByte) NotEquals

func (property PropertyByte) NotEquals(value byte) Condition

NotEquals finds entities with the stored property value different than the given value

func (PropertyByte) OrderAsc

func (property PropertyByte) OrderAsc() Condition

OrderAsc sets ascending order based on this property

func (PropertyByte) OrderDesc

func (property PropertyByte) OrderDesc() Condition

OrderDesc sets descending order based on this property

func (PropertyByte) OrderNilAsZero

func (property PropertyByte) OrderNilAsZero() Condition

OrderNilAsZero treats the nil value of the property the same as if it was 0

func (PropertyByte) OrderNilLast

func (property PropertyByte) OrderNilLast() Condition

OrderNilLast puts objects with nil value of the property at the end of the result set

type PropertyByteVector

type PropertyByteVector struct {
	*BaseProperty
}

PropertyByteVector holds information about a property and provides query building methods

func (PropertyByteVector) Equals

func (property PropertyByteVector) Equals(value []byte) Condition

Equals finds entities with the stored property value equal to the given value

func (PropertyByteVector) GreaterOrEqual

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

func (property PropertyByteVector) GreaterThan(value []byte) Condition

GreaterThan finds entities with the stored property value greater than the given value

func (PropertyByteVector) LessOrEqual

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

func (property PropertyByteVector) LessThan(value []byte) Condition

LessThan finds entities with the stored property value less than the given value

type PropertyFloat32

type PropertyFloat32 struct {
	*BaseProperty
}

PropertyFloat32 holds information about a property and provides query building methods

func (PropertyFloat32) Between

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

func (property PropertyFloat32) GreaterOrEqual(value float32) Condition

GreaterOrEqual finds entities with the stored property value greater than the given value

func (PropertyFloat32) GreaterThan

func (property PropertyFloat32) GreaterThan(value float32) Condition

GreaterThan finds entities with the stored property value greater than the given value

func (PropertyFloat32) LessOrEqual

func (property PropertyFloat32) LessOrEqual(value float32) Condition

LessOrEqual finds entities with the stored property value less than the given value

func (PropertyFloat32) LessThan

func (property PropertyFloat32) LessThan(value float32) Condition

LessThan finds entities with the stored property value less than the given value

func (PropertyFloat32) OrderAsc

func (property PropertyFloat32) OrderAsc() Condition

OrderAsc sets ascending order based on this property

func (PropertyFloat32) OrderDesc

func (property PropertyFloat32) OrderDesc() Condition

OrderDesc sets descending order based on this property

func (PropertyFloat32) OrderNilAsZero

func (property PropertyFloat32) OrderNilAsZero() Condition

OrderNilAsZero treats the nil value of the property the same as if it was 0

func (PropertyFloat32) OrderNilLast

func (property PropertyFloat32) OrderNilLast() Condition

OrderNilLast puts objects with nil value of the property at the end of the result set

type PropertyFloat64

type PropertyFloat64 struct {
	*BaseProperty
}

PropertyFloat64 holds information about a property and provides query building methods

func (PropertyFloat64) Between

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

func (property PropertyFloat64) GreaterOrEqual(value float64) Condition

GreaterOrEqual finds entities with the stored property value greater than the given value

func (PropertyFloat64) GreaterThan

func (property PropertyFloat64) GreaterThan(value float64) Condition

GreaterThan finds entities with the stored property value greater than the given value

func (PropertyFloat64) LessOrEqual

func (property PropertyFloat64) LessOrEqual(value float64) Condition

LessOrEqual finds entities with the stored property value less than the given value

func (PropertyFloat64) LessThan

func (property PropertyFloat64) LessThan(value float64) Condition

LessThan finds entities with the stored property value less than the given value

func (PropertyFloat64) OrderAsc

func (property PropertyFloat64) OrderAsc() Condition

OrderAsc sets ascending order based on this property

func (PropertyFloat64) OrderDesc

func (property PropertyFloat64) OrderDesc() Condition

OrderDesc sets descending order based on this property

func (PropertyFloat64) OrderNilAsZero

func (property PropertyFloat64) OrderNilAsZero() Condition

OrderNilAsZero treats the nil value of the property the same as if it was 0

func (PropertyFloat64) OrderNilLast

func (property PropertyFloat64) OrderNilLast() Condition

OrderNilLast puts objects with nil value of the property at the end of the result set

type PropertyInt

type PropertyInt struct {
	*BaseProperty
}

PropertyInt holds information about a property and provides query building methods

func (PropertyInt) Between

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

func (property PropertyInt) Equals(value int) Condition

Equals finds entities with the stored property value equal to the given value

func (PropertyInt) GreaterOrEqual

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

func (property PropertyInt) GreaterThan(value int) Condition

GreaterThan finds entities with the stored property value greater than the given value

func (PropertyInt) In

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

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

func (property PropertyInt) LessThan(value int) Condition

LessThan finds entities with the stored property value less than the given value

func (PropertyInt) NotEquals

func (property PropertyInt) NotEquals(value int) Condition

NotEquals finds entities with the stored property value different than the given value

func (PropertyInt) NotIn

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

func (property PropertyInt) OrderAsc() Condition

OrderAsc sets ascending order based on this property

func (PropertyInt) OrderDesc

func (property PropertyInt) OrderDesc() Condition

OrderDesc sets descending order based on this property

func (PropertyInt) OrderNilAsZero

func (property PropertyInt) OrderNilAsZero() Condition

OrderNilAsZero treats the nil value of the property the same as if it was 0

func (PropertyInt) OrderNilLast

func (property PropertyInt) OrderNilLast() Condition

OrderNilLast puts objects with nil value of the property at the end of the result set

type PropertyInt16

type PropertyInt16 struct {
	*BaseProperty
}

PropertyInt16 holds information about a property and provides query building methods

func (PropertyInt16) Between

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

func (property PropertyInt16) Equals(value int16) Condition

Equals finds entities with the stored property value equal to the given value

func (PropertyInt16) GreaterOrEqual

func (property PropertyInt16) GreaterOrEqual(value int16) Condition

GreaterOrEqual finds entities with the stored property value greater than the given value

func (PropertyInt16) GreaterThan

func (property PropertyInt16) GreaterThan(value int16) Condition

GreaterThan finds entities with the stored property value greater than the given value

func (PropertyInt16) LessOrEqual

func (property PropertyInt16) LessOrEqual(value int16) Condition

LessOrEqual finds entities with the stored property value less than the given value

func (PropertyInt16) LessThan

func (property PropertyInt16) LessThan(value int16) Condition

LessThan finds entities with the stored property value less than the given value

func (PropertyInt16) NotEquals

func (property PropertyInt16) NotEquals(value int16) Condition

NotEquals finds entities with the stored property value different than the given value

func (PropertyInt16) OrderAsc

func (property PropertyInt16) OrderAsc() Condition

OrderAsc sets ascending order based on this property

func (PropertyInt16) OrderDesc

func (property PropertyInt16) OrderDesc() Condition

OrderDesc sets descending order based on this property

func (PropertyInt16) OrderNilAsZero

func (property PropertyInt16) OrderNilAsZero() Condition

OrderNilAsZero treats the nil value of the property the same as if it was 0

func (PropertyInt16) OrderNilLast

func (property PropertyInt16) OrderNilLast() Condition

OrderNilLast puts objects with nil value of the property at the end of the result set

type PropertyInt32

type PropertyInt32 struct {
	*BaseProperty
}

PropertyInt32 holds information about a property and provides query building methods

func (PropertyInt32) Between

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

func (property PropertyInt32) Equals(value int32) Condition

Equals finds entities with the stored property value equal to the given value

func (PropertyInt32) GreaterOrEqual

func (property PropertyInt32) GreaterOrEqual(value int32) Condition

GreaterOrEqual finds entities with the stored property value greater than the given value

func (PropertyInt32) GreaterThan

func (property PropertyInt32) GreaterThan(value int32) Condition

GreaterThan finds entities with the stored property value greater than the given value

func (PropertyInt32) In

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

func (property PropertyInt32) LessOrEqual(value int32) Condition

LessOrEqual finds entities with the stored property value less than the given value

func (PropertyInt32) LessThan

func (property PropertyInt32) LessThan(value int32) Condition

LessThan finds entities with the stored property value less than the given value

func (PropertyInt32) NotEquals

func (property PropertyInt32) NotEquals(value int32) Condition

NotEquals finds entities with the stored property value different than the given value

func (PropertyInt32) NotIn

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

func (property PropertyInt32) OrderAsc() Condition

OrderAsc sets ascending order based on this property

func (PropertyInt32) OrderDesc

func (property PropertyInt32) OrderDesc() Condition

OrderDesc sets descending order based on this property

func (PropertyInt32) OrderNilAsZero

func (property PropertyInt32) OrderNilAsZero() Condition

OrderNilAsZero treats the nil value of the property the same as if it was 0

func (PropertyInt32) OrderNilLast

func (property PropertyInt32) OrderNilLast() Condition

OrderNilLast puts objects with nil value of the property at the end of the result set

type PropertyInt64

type PropertyInt64 struct {
	*BaseProperty
}

PropertyInt64 holds information about a property and provides query building methods

func (PropertyInt64) Between

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

func (property PropertyInt64) Equals(value int64) Condition

Equals finds entities with the stored property value equal to the given value

func (PropertyInt64) GreaterOrEqual

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

func (property PropertyInt64) GreaterThan(value int64) Condition

GreaterThan finds entities with the stored property value greater than the given value

func (PropertyInt64) In

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

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

func (property PropertyInt64) LessThan(value int64) Condition

LessThan finds entities with the stored property value less than the given value

func (PropertyInt64) NotEquals

func (property PropertyInt64) NotEquals(value int64) Condition

NotEquals finds entities with the stored property value different than the given value

func (PropertyInt64) NotIn

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

func (property PropertyInt64) OrderAsc() Condition

OrderAsc sets ascending order based on this property

func (PropertyInt64) OrderDesc

func (property PropertyInt64) OrderDesc() Condition

OrderDesc sets descending order based on this property

func (PropertyInt64) OrderNilAsZero

func (property PropertyInt64) OrderNilAsZero() Condition

OrderNilAsZero treats the nil value of the property the same as if it was 0

func (PropertyInt64) OrderNilLast

func (property PropertyInt64) OrderNilLast() Condition

OrderNilLast puts objects with nil value of the property at the end of the result set

type PropertyInt8

type PropertyInt8 struct {
	*BaseProperty
}

PropertyInt8 holds information about a property and provides query building methods

func (PropertyInt8) Between

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

func (property PropertyInt8) Equals(value int8) Condition

Equals finds entities with the stored property value equal to the given value

func (PropertyInt8) GreaterOrEqual

func (property PropertyInt8) GreaterOrEqual(value int8) Condition

GreaterOrEqual finds entities with the stored property value greater than the given value

func (PropertyInt8) GreaterThan

func (property PropertyInt8) GreaterThan(value int8) Condition

GreaterThan finds entities with the stored property value greater than the given value

func (PropertyInt8) LessOrEqual

func (property PropertyInt8) LessOrEqual(value int8) Condition

LessOrEqual finds entities with the stored property value less than the given value

func (PropertyInt8) LessThan

func (property PropertyInt8) LessThan(value int8) Condition

LessThan finds entities with the stored property value less than the given value

func (PropertyInt8) NotEquals

func (property PropertyInt8) NotEquals(value int8) Condition

NotEquals finds entities with the stored property value different than the given value

func (PropertyInt8) OrderAsc

func (property PropertyInt8) OrderAsc() Condition

OrderAsc sets ascending order based on this property

func (PropertyInt8) OrderDesc

func (property PropertyInt8) OrderDesc() Condition

OrderDesc sets descending order based on this property

func (PropertyInt8) OrderNilAsZero

func (property PropertyInt8) OrderNilAsZero() Condition

OrderNilAsZero treats the nil value of the property the same as if it was 0

func (PropertyInt8) OrderNilLast

func (property PropertyInt8) OrderNilLast() Condition

OrderNilLast puts objects with nil value of the property at the end of the result set

type PropertyRune

type PropertyRune struct {
	*BaseProperty
}

PropertyRune holds information about a property and provides query building methods

func (PropertyRune) Between

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

func (property PropertyRune) Equals(value rune) Condition

Equals finds entities with the stored property value equal to the given value

func (PropertyRune) GreaterOrEqual

func (property PropertyRune) GreaterOrEqual(value rune) Condition

GreaterOrEqual finds entities with the stored property value greater than the given value

func (PropertyRune) GreaterThan

func (property PropertyRune) GreaterThan(value rune) Condition

GreaterThan finds entities with the stored property value greater than the given value

func (PropertyRune) In

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

func (property PropertyRune) LessOrEqual(value rune) Condition

LessOrEqual finds entities with the stored property value less than the given value

func (PropertyRune) LessThan

func (property PropertyRune) LessThan(value rune) Condition

LessThan finds entities with the stored property value less than the given value

func (PropertyRune) NotEquals

func (property PropertyRune) NotEquals(value rune) Condition

NotEquals finds entities with the stored property value different than the given value

func (PropertyRune) NotIn

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

func (property PropertyRune) OrderAsc() Condition

OrderAsc sets ascending order based on this property

func (PropertyRune) OrderDesc

func (property PropertyRune) OrderDesc() Condition

OrderDesc sets descending order based on this property

func (PropertyRune) OrderNilAsZero

func (property PropertyRune) OrderNilAsZero() Condition

OrderNilAsZero treats the nil value of the property the same as if it was 0

func (PropertyRune) OrderNilLast

func (property PropertyRune) OrderNilLast() Condition

OrderNilLast puts objects with nil value of the property at the end of the result set

type PropertyString

type PropertyString struct {
	*BaseProperty
}

PropertyString holds information about a property and provides query building methods

func (PropertyString) Contains

func (property PropertyString) Contains(text string, caseSensitive bool) Condition

Contains finds entities with the stored property value contains the given text

func (PropertyString) Equals

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

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

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

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

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

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

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

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

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

func (property PropertyString) OrderAsc(caseSensitive bool) Condition

OrderAsc sets ascending order based on this property

func (PropertyString) OrderDesc

func (property PropertyString) OrderDesc(caseSensitive bool) Condition

OrderDesc sets descending order based on this property

func (PropertyString) OrderNilLast

func (property PropertyString) OrderNilLast() Condition

OrderNilLast puts objects with nil value of the property at the end of the result set

type PropertyStringVector

type PropertyStringVector struct {
	*BaseProperty
}

PropertyStringVector holds information about a property and provides query building methods

func (PropertyStringVector) Contains

func (property PropertyStringVector) Contains(text string, caseSensitive bool) Condition

Contains finds entities with the stored property value contains the given text

type PropertyUint

type PropertyUint struct {
	*BaseProperty
}

PropertyUint holds information about a property and provides query building methods

func (PropertyUint) Between

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

func (property PropertyUint) Equals(value uint) Condition

Equals finds entities with the stored property value equal to the given value

func (PropertyUint) GreaterOrEqual

func (property PropertyUint) GreaterOrEqual(value uint) Condition

GreaterOrEqual finds entities with the stored property value greater than the given value

func (PropertyUint) GreaterThan

func (property PropertyUint) GreaterThan(value uint) Condition

GreaterThan finds entities with the stored property value greater than the given value

func (PropertyUint) In

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

func (property PropertyUint) LessOrEqual(value uint) Condition

LessOrEqual finds entities with the stored property value less than the given value

func (PropertyUint) LessThan

func (property PropertyUint) LessThan(value uint) Condition

LessThan finds entities with the stored property value less than the given value

func (PropertyUint) NotEquals

func (property PropertyUint) NotEquals(value uint) Condition

NotEquals finds entities with the stored property value different than the given value

func (PropertyUint) NotIn

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

func (property PropertyUint) OrderAsc() Condition

OrderAsc sets ascending order based on this property

func (PropertyUint) OrderDesc

func (property PropertyUint) OrderDesc() Condition

OrderDesc sets descending order based on this property

func (PropertyUint) OrderNilAsZero

func (property PropertyUint) OrderNilAsZero() Condition

OrderNilAsZero treats the nil value of the property the same as if it was 0

func (PropertyUint) OrderNilLast

func (property PropertyUint) OrderNilLast() Condition

OrderNilLast puts objects with nil value of the property at the end of the result set

type PropertyUint16

type PropertyUint16 struct {
	*BaseProperty
}

PropertyUint16 holds information about a property and provides query building methods

func (PropertyUint16) Between

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

func (property PropertyUint16) Equals(value uint16) Condition

Equals finds entities with the stored property value equal to the given value

func (PropertyUint16) GreaterOrEqual

func (property PropertyUint16) GreaterOrEqual(value uint16) Condition

GreaterOrEqual finds entities with the stored property value greater than the given value

func (PropertyUint16) GreaterThan

func (property PropertyUint16) GreaterThan(value uint16) Condition

GreaterThan finds entities with the stored property value greater than the given value

func (PropertyUint16) LessOrEqual

func (property PropertyUint16) LessOrEqual(value uint16) Condition

LessOrEqual finds entities with the stored property value less than the given value

func (PropertyUint16) LessThan

func (property PropertyUint16) LessThan(value uint16) Condition

LessThan finds entities with the stored property value less than the given value

func (PropertyUint16) NotEquals

func (property PropertyUint16) NotEquals(value uint16) Condition

NotEquals finds entities with the stored property value different than the given value

func (PropertyUint16) OrderAsc

func (property PropertyUint16) OrderAsc() Condition

OrderAsc sets ascending order based on this property

func (PropertyUint16) OrderDesc

func (property PropertyUint16) OrderDesc() Condition

OrderDesc sets descending order based on this property

func (PropertyUint16) OrderNilAsZero

func (property PropertyUint16) OrderNilAsZero() Condition

OrderNilAsZero treats the nil value of the property the same as if it was 0

func (PropertyUint16) OrderNilLast

func (property PropertyUint16) OrderNilLast() Condition

OrderNilLast puts objects with nil value of the property at the end of the result set

type PropertyUint32

type PropertyUint32 struct {
	*BaseProperty
}

PropertyUint32 holds information about a property and provides query building methods

func (PropertyUint32) Between

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

func (property PropertyUint32) Equals(value uint32) Condition

Equals finds entities with the stored property value equal to the given value

func (PropertyUint32) GreaterOrEqual

func (property PropertyUint32) GreaterOrEqual(value uint32) Condition

GreaterOrEqual finds entities with the stored property value greater than the given value

func (PropertyUint32) GreaterThan

func (property PropertyUint32) GreaterThan(value uint32) Condition

GreaterThan finds entities with the stored property value greater than the given value

func (PropertyUint32) In

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

func (property PropertyUint32) LessOrEqual(value uint32) Condition

LessOrEqual finds entities with the stored property value less than the given value

func (PropertyUint32) LessThan

func (property PropertyUint32) LessThan(value uint32) Condition

LessThan finds entities with the stored property value less than the given value

func (PropertyUint32) NotEquals

func (property PropertyUint32) NotEquals(value uint32) Condition

NotEquals finds entities with the stored property value different than the given value

func (PropertyUint32) NotIn

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

func (property PropertyUint32) OrderAsc() Condition

OrderAsc sets ascending order based on this property

func (PropertyUint32) OrderDesc

func (property PropertyUint32) OrderDesc() Condition

OrderDesc sets descending order based on this property

func (PropertyUint32) OrderNilAsZero

func (property PropertyUint32) OrderNilAsZero() Condition

OrderNilAsZero treats the nil value of the property the same as if it was 0

func (PropertyUint32) OrderNilLast

func (property PropertyUint32) OrderNilLast() Condition

OrderNilLast puts objects with nil value of the property at the end of the result set

type PropertyUint64

type PropertyUint64 struct {
	*BaseProperty
}

PropertyUint64 holds information about a property and provides query building methods

func (PropertyUint64) Between

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

func (property PropertyUint64) Equals(value uint64) Condition

Equals finds entities with the stored property value equal to the given value

func (PropertyUint64) GreaterOrEqual

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

func (property PropertyUint64) GreaterThan(value uint64) Condition

GreaterThan finds entities with the stored property value greater than the given value

func (PropertyUint64) In

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

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

func (property PropertyUint64) LessThan(value uint64) Condition

LessThan finds entities with the stored property value less than the given value

func (PropertyUint64) NotEquals

func (property PropertyUint64) NotEquals(value uint64) Condition

NotEquals finds entities with the stored property value different than the given value

func (PropertyUint64) NotIn

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

func (property PropertyUint64) OrderAsc() Condition

OrderAsc sets ascending order based on this property

func (PropertyUint64) OrderDesc

func (property PropertyUint64) OrderDesc() Condition

OrderDesc sets descending order based on this property

func (PropertyUint64) OrderNilAsZero

func (property PropertyUint64) OrderNilAsZero() Condition

OrderNilAsZero treats the nil value of the property the same as if it was 0

func (PropertyUint64) OrderNilLast

func (property PropertyUint64) OrderNilLast() Condition

OrderNilLast puts objects with nil value of the property at the end of the result set

type PropertyUint8

type PropertyUint8 struct {
	*BaseProperty
}

PropertyUint8 holds information about a property and provides query building methods

func (PropertyUint8) Between

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

func (property PropertyUint8) Equals(value uint8) Condition

Equals finds entities with the stored property value equal to the given value

func (PropertyUint8) GreaterOrEqual

func (property PropertyUint8) GreaterOrEqual(value uint8) Condition

GreaterOrEqual finds entities with the stored property value greater than the given value

func (PropertyUint8) GreaterThan

func (property PropertyUint8) GreaterThan(value uint8) Condition

GreaterThan finds entities with the stored property value greater than the given value

func (PropertyUint8) LessOrEqual

func (property PropertyUint8) LessOrEqual(value uint8) Condition

LessOrEqual finds entities with the stored property value less than the given value

func (PropertyUint8) LessThan

func (property PropertyUint8) LessThan(value uint8) Condition

LessThan finds entities with the stored property value less than the given value

func (PropertyUint8) NotEquals

func (property PropertyUint8) NotEquals(value uint8) Condition

NotEquals finds entities with the stored property value different than the given value

func (PropertyUint8) OrderAsc

func (property PropertyUint8) OrderAsc() Condition

OrderAsc sets ascending order based on this property

func (PropertyUint8) OrderDesc

func (property PropertyUint8) OrderDesc() Condition

OrderDesc sets descending order based on this property

func (PropertyUint8) OrderNilAsZero

func (property PropertyUint8) OrderNilAsZero() Condition

OrderNilAsZero treats the nil value of the property the same as if it was 0

func (PropertyUint8) OrderNilLast

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

func (query *Query) Close() error

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

func (query *Query) Count() (uint64, error)

Count returns the number of objects matching the query. Currently can't be used in combination with Offset().

func (*Query) DescribeParams

func (query *Query) DescribeParams() (string, error)

DescribeParams returns a string representation of the query conditions

func (*Query) Find

func (query *Query) Find() (objects interface{}, err error)

Find returns all objects matching the query

func (*Query) FindIds

func (query *Query) FindIds() ([]uint64, error)

FindIds returns IDs of all objects matching the query

func (*Query) Limit

func (query *Query) Limit(limit uint64) *Query

Limit sets the number of elements to process by the query

func (*Query) Offset

func (query *Query) Offset(offset uint64) *Query

Offset defines the index of the first object to process (how many objects to skip)

func (*Query) Remove

func (query *Query) Remove() (count uint64, err error)

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

func (query *Query) SetBytesParams(identifier propertyOrAlias, values ...[]byte) error

SetBytesParams changes query parameter values on the given property

func (*Query) SetFloat64Params

func (query *Query) SetFloat64Params(identifier propertyOrAlias, values ...float64) error

SetFloat64Params changes query parameter values on the given property

func (*Query) SetInt32ParamsIn

func (query *Query) SetInt32ParamsIn(identifier propertyOrAlias, values ...int32) error

SetInt32ParamsIn changes query parameter values on the given property

func (*Query) SetInt64Params

func (query *Query) SetInt64Params(identifier propertyOrAlias, values ...int64) error

SetInt64Params changes query parameter values on the given property

func (*Query) SetInt64ParamsIn

func (query *Query) SetInt64ParamsIn(identifier propertyOrAlias, values ...int64) error

SetInt64ParamsIn changes query parameter values on the given property

func (*Query) SetStringParams

func (query *Query) SetStringParams(identifier propertyOrAlias, values ...string) error

SetStringParams changes query parameter values on the given property

func (*Query) SetStringParamsIn

func (query *Query) SetStringParamsIn(identifier propertyOrAlias, values ...string) error

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

func (qb *QueryBuilder) Alias(alias string) error

Alias sets an alias for the last created condition

func (*QueryBuilder) All

func (qb *QueryBuilder) All(ids []ConditionId) (ConditionId, error)

All is called internally

func (*QueryBuilder) Any

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

func (qb *QueryBuilder) BytesEqual(property *BaseProperty, value []byte) (ConditionId, error)

BytesEqual is called internally

func (*QueryBuilder) BytesGreater

func (qb *QueryBuilder) BytesGreater(property *BaseProperty, value []byte, withEqual bool) (ConditionId, error)

BytesGreater is called internally

func (*QueryBuilder) BytesLess

func (qb *QueryBuilder) BytesLess(property *BaseProperty, value []byte, withEqual bool) (ConditionId, error)

BytesLess is called internally

func (*QueryBuilder) Close

func (qb *QueryBuilder) Close() error

Close is called internally

func (*QueryBuilder) DoubleBetween

func (qb *QueryBuilder) DoubleBetween(property *BaseProperty, valueA float64, valueB float64) (ConditionId, error)

DoubleBetween is called internally

func (*QueryBuilder) DoubleGreater

func (qb *QueryBuilder) DoubleGreater(property *BaseProperty, value float64, withEqual bool) (ConditionId, error)

DoubleGreater is called internally

func (*QueryBuilder) DoubleLess

func (qb *QueryBuilder) DoubleLess(property *BaseProperty, value float64, withEqual bool) (ConditionId, error)

DoubleLess is called internally

func (*QueryBuilder) Int32In

func (qb *QueryBuilder) Int32In(property *BaseProperty, values []int32) (ConditionId, error)

Int32In is called internally

func (*QueryBuilder) Int32NotIn

func (qb *QueryBuilder) Int32NotIn(property *BaseProperty, values []int32) (ConditionId, error)

Int32NotIn is called internally

func (*QueryBuilder) Int64In

func (qb *QueryBuilder) Int64In(property *BaseProperty, values []int64) (ConditionId, error)

Int64In is called internally

func (*QueryBuilder) Int64NotIn

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

func (qb *QueryBuilder) IntEqual(property *BaseProperty, value int64) (ConditionId, error)

IntEqual is called internally

func (*QueryBuilder) IntGreater

func (qb *QueryBuilder) IntGreater(property *BaseProperty, value int64, withEqual bool) (ConditionId, error)

IntGreater is called internally

func (*QueryBuilder) IntLess

func (qb *QueryBuilder) IntLess(property *BaseProperty, value int64, withEqual bool) (ConditionId, error)

IntLess is called internally

func (*QueryBuilder) IntNotEqual

func (qb *QueryBuilder) IntNotEqual(property *BaseProperty, value int64) (ConditionId, error)

IntNotEqual is called internally

func (*QueryBuilder) IsNil

func (qb *QueryBuilder) IsNil(property *BaseProperty) (ConditionId, error)

IsNil is called internally

func (*QueryBuilder) IsNotNil

func (qb *QueryBuilder) IsNotNil(property *BaseProperty) (ConditionId, error)

IsNotNil is called internally

func (*QueryBuilder) LinkManyToMany

func (qb *QueryBuilder) LinkManyToMany(relation *RelationToMany, conditions []Condition) error

LinkManyToMany is called internally

func (*QueryBuilder) LinkOneToMany

func (qb *QueryBuilder) LinkOneToMany(relation *RelationToOne, conditions []Condition) error

LinkOneToMany is called internally

func (*QueryBuilder) StringContains

func (qb *QueryBuilder) StringContains(property *BaseProperty, value string, caseSensitive bool) (ConditionId, error)

StringContains is called internally

func (*QueryBuilder) StringEquals

func (qb *QueryBuilder) StringEquals(property *BaseProperty, value string, caseSensitive bool) (ConditionId, error)

StringEquals is called internally

func (*QueryBuilder) StringGreater

func (qb *QueryBuilder) StringGreater(property *BaseProperty, value string, caseSensitive bool, withEqual bool) (ConditionId, error)

StringGreater is called internally

func (*QueryBuilder) StringHasPrefix

func (qb *QueryBuilder) StringHasPrefix(property *BaseProperty, value string, caseSensitive bool) (ConditionId, error)

StringHasPrefix is called internally

func (*QueryBuilder) StringHasSuffix

func (qb *QueryBuilder) StringHasSuffix(property *BaseProperty, value string, caseSensitive bool) (ConditionId, error)

StringHasSuffix is called internally

func (*QueryBuilder) StringIn

func (qb *QueryBuilder) StringIn(property *BaseProperty, values []string, caseSensitive bool) (ConditionId, error)

StringIn is called internally

func (*QueryBuilder) StringLess

func (qb *QueryBuilder) StringLess(property *BaseProperty, value string, caseSensitive bool, withEqual bool) (ConditionId, error)

StringLess is called internally

func (*QueryBuilder) StringNotEquals

func (qb *QueryBuilder) StringNotEquals(property *BaseProperty, value string, caseSensitive bool) (ConditionId, error)

StringNotEquals is called internally

func (*QueryBuilder) StringVectorContains

func (qb *QueryBuilder) StringVectorContains(property *BaseProperty, value string, caseSensitive bool) (ConditionId, error)

StringVectorContains is called internally

type RelationToMany

type RelationToMany struct {
	Id     TypeId
	Source *Entity
	Target *Entity
}

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 (relation *RelationToMany) Link(conditions ...Condition) Condition

Link creates a connection and takes inner conditions to evaluate on the linked entity.

type RelationToOne

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

func (relation RelationToOne) Equals(value uint64) Condition

Equals finds entities with relation target ID equal to the given value

func (RelationToOne) In

func (relation RelationToOne) In(values ...uint64) Condition

In finds entities with relation target ID equal to any of the given values

func (relation *RelationToOne) Link(conditions ...Condition) Condition

Link creates a connection and takes inner conditions to evaluate on the linked entity.

func (RelationToOne) NotEquals

func (relation RelationToOne) NotEquals(value uint64) Condition

NotEquals finds entities with relation target ID different than the given value

func (RelationToOne) NotIn

func (relation RelationToOne) NotIn(values ...uint64) Condition

NotIn finds entities with relation target ID not equal to any the given values

type SyncChange

type SyncChange struct {
	EntityId TypeId
	Puts     []uint64
	Removals []uint64
}

SyncChange describes a single incoming data event received by the sync client

type SyncClient

type SyncClient struct {
	// contains filtered or unexported fields
}

SyncClient is used to connect to an ObjectBox sync server.

func NewSyncClient

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

func (client *SyncClient) CancelUpdates() error

CancelUpdates can be used to unsubscribe from manually requested updates (see `RequestUpdates(true)`).

func (*SyncClient) Close

func (client *SyncClient) Close() error

Close stops synchronization and frees the resources.

func (*SyncClient) IsClosed

func (client *SyncClient) IsClosed() bool

IsClosed returns true if this sync client is closed and can no longer be used.

func (*SyncClient) RequestUpdates

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

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

func (client *SyncClient) SetCompletionListener(callback syncCompletionListener) error

SetCompletionListener sets or overrides a previously set listener for a "login" event.

func (*SyncClient) SetConnectionListener

func (client *SyncClient) SetConnectionListener(callback syncConnectionListener) error

SetConnectionListener sets or overrides a previously set listener for a "connection" event.

func (*SyncClient) SetCredentials

func (client *SyncClient) SetCredentials(credentials *SyncCredentials) error

SetCredentials configures authentication credentials, depending on your server config.

func (*SyncClient) SetDisconnectionListener

func (client *SyncClient) SetDisconnectionListener(callback syncDisconnectionListener) error

SetDisconnectionListener sets or overrides a previously set listener for a "disconnection" event.

func (*SyncClient) SetLoginFailureListener

func (client *SyncClient) SetLoginFailureListener(callback syncLoginFailureListener) error

SetLoginFailureListener sets or overrides a previously set listener for a "login" event.

func (*SyncClient) SetLoginListener

func (client *SyncClient) SetLoginListener(callback syncLoginListener) error

SetLoginListener sets or overrides a previously set listener for a "login" event.

func (*SyncClient) SetRequestUpdatesMode

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

func (client *SyncClient) SetServerTimeListener(callback syncTimeListener) error

SetServerTimeListener sets or overrides a previously set listener for a "login" event.

func (*SyncClient) Start

func (client *SyncClient) Start() error

Start initiates the connection to the server and begins the synchronization

func (*SyncClient) State

func (client *SyncClient) State() SyncClientState

State returns the current state of the sync client

func (*SyncClient) Stop

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

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

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

type SyncCredentials struct {
	// contains filtered or unexported fields
}

SyncCredentials are used to authenticate a sync client against a server.

func SyncCredentialsGoogleAuth

func SyncCredentialsGoogleAuth(data []byte) *SyncCredentials

SyncCredentialsGoogleAuth - Google authentication

func SyncCredentialsNone

func SyncCredentialsNone() *SyncCredentials

SyncCredentialsNone - no credentials - usually only for development, with a server configured to accept all connections without authentication.

func SyncCredentialsSharedSecret

func SyncCredentialsSharedSecret(data []byte) *SyncCredentials

SyncCredentialsSharedSecret - shared secret authentication

type SyncLoginFailure

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

type Version struct {
	Major int
	Minor int
	Patch int
	Label string
}

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

func VersionGo() Version

VersionGo returns the Version of the ObjectBox-Go binding

func VersionLib

func VersionLib() Version

VersionLib returns the Version of the dynamic linked ObjectBox library

func (Version) String

func (v Version) String() string

Directories

Path Synopsis
Package fbutils provides utilities for the FlatBuffers in ObjectBox
Package fbutils provides utilities for the FlatBuffers in ObjectBox

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto