objectbox-go: github.com/objectbox/objectbox-go/objectbox Index | Files | Directories

package objectbox

import "github.com/objectbox/objectbox-go/objectbox"

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 objectbox-gogen

type Person struct {
   Id        uint64 `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

Package Files

box.go builder.go c-arrays.go condition.go converters.go cursor.go datavisitor.go doc.go entity.go internaltestaccess.go model.go objectbox.go property.go query.go querybuilder.go relation.go transaction.go version.go

Constants

const (
    PropertyType_Bool         = 1
    PropertyType_Byte         = 2
    PropertyType_Short        = 3
    PropertyType_Char         = 4
    PropertyType_Int          = 5
    PropertyType_Long         = 6
    PropertyType_Float        = 7
    PropertyType_Double       = 8
    PropertyType_String       = 9
    PropertyType_Date         = 10
    PropertyType_Relation     = 11
    PropertyType_ByteVector   = 23
    PropertyType_StringVector = 30
)

noinspection GoUnusedConst

const (
    /// One long property on an entity must be the ID
    PropertyFlags_ID = 1

    /// On languages like Java, a non-primitive type is used (aka wrapper types, allowing null)
    PropertyFlags_NON_PRIMITIVE_TYPE = 2

    /// Unused yet
    PropertyFlags_NOT_NULL = 4
    PropertyFlags_INDEXED  = 8
    PropertyFlags_RESERVED = 16
    /// Unused yet: Unique index
    PropertyFlags_UNIQUE = 32
    /// Unused yet: Use a persisted sequence to enforce ID to rise monotonic (no ID reuse)
    PropertyFlags_ID_MONOTONIC_SEQUENCE = 64
    /// Allow IDs to be assigned by the developer
    PropertyFlags_ID_SELF_ASSIGNABLE = 128
    /// Unused yet
    PropertyFlags_INDEX_PARTIAL_SKIP_NULL = 256
    /// Unused yet, used by References for 1) back-references and 2) to clear references to deleted objects (required for ID reuse)
    PropertyFlags_INDEX_PARTIAL_SKIP_ZERO = 512
    /// Virtual properties may not have a dedicated field in their entity class, e.g. target IDs of to-one relations
    PropertyFlags_VIRTUAL = 1024

    PropertyFlags_INDEX_HASH = 2048
    /// Index uses a 64 bit hash instead of the value
    /// (recommended mostly for 64 bit machines with values longer >200 bytes; small values are faster with a 32 bit hash)
    PropertyFlags_INDEX_HASH64 = 4096

    /// The actual type of the variable is unsigned (used in combination with numeric OBXPropertyType_*)
    PropertyFlags_UNSIGNED = 8192
)

noinspection GoUnusedConst

const (
    DebugFlags_LOG_TRANSACTIONS_READ  = 1
    DebugFlags_LOG_TRANSACTIONS_WRITE = 2
    DebugFlags_LOG_QUERIES            = 4
    DebugFlags_LOG_QUERY_PARAMETERS   = 8
    DebugFlags_LOG_ASYNC_QUEUE        = 16
)

noinspection GoUnusedConst

func StringIdConvertToDatabaseValue Uses

func StringIdConvertToDatabaseValue(goValue string) uint64

implements "StringIdConvert" property value converter

func StringIdConvertToEntityProperty Uses

func StringIdConvertToEntityProperty(dbValue uint64) (goValue string)

implements "StringIdConvert" property value converter

func VersionInfo Uses

func VersionInfo() string

A printable version string

type BaseProperty Uses

type BaseProperty struct {
    Id     TypeId
    Entity *Entity
}

type Box Uses

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

Box provides CRUD access to objects of a common type

func (*Box) Contains Uses

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

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

func (*Box) Count Uses

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

Count returns a number of objects stored

func (*Box) CountMax Uses

func (box *Box) CountMax(max uint64) (count uint64, err error)

CountMax returns a number of objects stored (up to a given maximum)

func (*Box) Get Uses

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 Uses

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

Get reads a 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) IsEmpty Uses

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

IsEmpty checks whether the box contains any objects

func (*Box) Put Uses

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) PutAll Uses

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

PutAll inserts multiple objects in 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) PutAsync Uses

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

PutAsync asynchronously inserts/updates a single object. When inserting, the ID property on the passed object will be assigned the new ID as well.

It's executed on a separate internal thread for better performance.

There are two main use cases:

1) "Put & Forget:" you gain faster puts 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, this method may be throttled (~1ms) or delayed up to options.putAsyncTimeout (10 seconds by default). In the unlikely event that the object could not be enqueued after delaying (because of a full queue), an error will be returned.

Note that this method does not give you hard durability guarantees like the synchronous Put provides. There is a small time window in which the data may not have been committed durably yet.

func (*Box) PutAsyncWithTimeout Uses

func (box *Box) PutAsyncWithTimeout(object interface{}, timeoutMs uint) (id uint64, err error)

Same as PutAsync but with a custom enqueue timeout

func (*Box) Query Uses

func (box *Box) Query(conditions ...Condition) *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 Uses

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

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

func (*Box) Remove Uses

func (box *Box) Remove(id uint64) (err error)

Remove deletes a single object

func (*Box) RemoveAll Uses

func (box *Box) RemoveAll() (err error)

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

type Builder Uses

type Builder struct {
    Error error
    // contains filtered or unexported fields
}

Builder provides tools to fully configure and construct ObjectBox

func NewBuilder Uses

func NewBuilder() *Builder

func (*Builder) AlwaysAwaitAsync Uses

func (builder *Builder) AlwaysAwaitAsync(value bool) *Builder

Enables automatic waiting for async operations between executing a synchronous one. This can be replaced if you're using PutAsync in many places and need to make sure the operation has finished before your data you read/query/delete,... is executed. Calls ObjectBox.AwaitAsyncCompletion() internally.

func (*Builder) Build Uses

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 Uses

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

Build validates the configuration and tries to init the ObjectBox.

func (*Builder) Directory Uses

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

Directory configures the path where the database is stored

func (*Builder) MaxReaders Uses

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

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

func (*Builder) MaxSizeInKb Uses

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

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

func (*Builder) Model Uses

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

func (*Builder) PutAsyncTimeout Uses

func (builder *Builder) PutAsyncTimeout(milliseconds uint) *Builder

Configures PutAsync enqueue timeout (default is 10 seconds). See Box.PutAsync method doc for more information.

type Condition Uses

type Condition interface {
    // contains filtered or unexported methods
}

func All Uses

func All(conditions ...Condition) Condition

func Any Uses

func Any(conditions ...Condition) Condition

type ConditionId Uses

type ConditionId = int32

type Cursor Uses

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

Internal: won't be publicly exposed in a future version!

func (*Cursor) Close Uses

func (cursor *Cursor) Close() error

func (*Cursor) Count Uses

func (cursor *Cursor) Count() (count uint64, err error)

func (*Cursor) CountMax Uses

func (cursor *Cursor) CountMax(max uint64) (count uint64, err error)

func (*Cursor) Get Uses

func (cursor *Cursor) Get(id uint64) (object interface{}, err error)

func (*Cursor) GetAll Uses

func (cursor *Cursor) GetAll() (slice interface{}, err error)

func (*Cursor) IdForPut Uses

func (cursor *Cursor) IdForPut(idCandidate uint64) (id uint64, err error)

func (*Cursor) IsEmpty Uses

func (cursor *Cursor) IsEmpty() (result bool, err error)

func (*Cursor) Put Uses

func (cursor *Cursor) Put(object interface{}) (id uint64, err error)

func (*Cursor) RelationGetAll Uses

func (cursor *Cursor) RelationGetAll(relationId TypeId, targetEntityId TypeId, sourceId uint64) (slice interface{}, err error)

Get all target objects from a standalone relation TODO don't require a targetEntityId, it can retrieved using a relationId

func (*Cursor) RelationIds Uses

func (cursor *Cursor) RelationIds(relationId TypeId, sourceId uint64) ([]uint64, error)

func (*Cursor) RelationPut Uses

func (cursor *Cursor) RelationPut(relationId TypeId, sourceId, targetId uint64) error

func (*Cursor) RelationRemove Uses

func (cursor *Cursor) RelationRemove(relationId TypeId, sourceId, targetId uint64) error

func (*Cursor) RelationReplace Uses

func (cursor *Cursor) RelationReplace(relationId TypeId, targetEntityId TypeId, sourceId uint64, sourceObject interface{}, targetObjects interface{}) (err 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). TODO don't require a targetEntityId, it can retrieved using a relationId

func (*Cursor) Remove Uses

func (cursor *Cursor) Remove(id uint64) (err error)

func (*Cursor) RemoveAll Uses

func (cursor *Cursor) RemoveAll() (err error)

type Entity Uses

type Entity struct {
    Id TypeId
}

this is used publicly in the model/bindings

type InternalTestAccessObjectBox Uses

type InternalTestAccessObjectBox struct {
    ObjectBox *ObjectBox
}

Internal: Reserved for internal unit tests only and won't be exposed in the future

func (*InternalTestAccessObjectBox) RunInTxn Uses

func (obx *InternalTestAccessObjectBox) RunInTxn(readOnly bool, txnFun txnFun) (err error)

type Model Uses

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 Uses

func NewModel() *Model

func (*Model) Entity Uses

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

func (*Model) EntityLastPropertyId Uses

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

func (*Model) GeneratorVersion Uses

func (model *Model) GeneratorVersion(version int)

func (*Model) LastEntityId Uses

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

func (*Model) LastIndexId Uses

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

func (*Model) LastRelationId Uses

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

func (*Model) Property Uses

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

func (*Model) PropertyFlags Uses

func (model *Model) PropertyFlags(propertyFlags int)

func (*Model) PropertyIndex Uses

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

func (*Model) PropertyRelation Uses

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

func (*Model) RegisterBinding Uses

func (model *Model) RegisterBinding(binding ObjectBinding)

func (*Model) Relation Uses

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 Uses

type ObjectBinding interface {
    AddToModel(model *Model)
    GetId(object interface{}) (id uint64, err error)
    SetId(object interface{}, id uint64)
    PutRelated(txn *Transaction, object interface{}, id uint64) error
    Flatten(object interface{}, fbb *flatbuffers.Builder, id uint64) error
    Load(txn *Transaction, bytes []byte) (interface{}, error)
    MakeSlice(capacity int) interface{}
    AppendToSlice(slice interface{}, object interface{}) (sliceNew interface{})
    GeneratorVersion() int
}

An ObjectBinding provides an interface for various object types to be included in the model

type ObjectBox Uses

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

func (*ObjectBox) AwaitAsyncCompletion Uses

func (ob *ObjectBox) AwaitAsyncCompletion() *ObjectBox

AwaitAsyncCompletion blocks until all PutAsync insert have been processed

func (*ObjectBox) Close Uses

func (ob *ObjectBox) Close()

Close fully closes the database and free's resources

func (*ObjectBox) InternalBox Uses

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

panics on error (in case entity with the given ID doesn't exist)

func (*ObjectBox) SetDebugFlags Uses

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

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

type Property Uses

type Property interface {
    // contains filtered or unexported methods
}

type PropertyBool Uses

type PropertyBool struct {
    *BaseProperty
}

func (PropertyBool) Equals Uses

func (property PropertyBool) Equals(value bool) Condition

type PropertyByte Uses

type PropertyByte struct {
    *BaseProperty
}

func (PropertyByte) Between Uses

func (property PropertyByte) Between(a, b byte) Condition

func (PropertyByte) Equals Uses

func (property PropertyByte) Equals(value byte) Condition

func (PropertyByte) GreaterThan Uses

func (property PropertyByte) GreaterThan(value byte) Condition

func (PropertyByte) LessThan Uses

func (property PropertyByte) LessThan(value byte) Condition

func (PropertyByte) NotEquals Uses

func (property PropertyByte) NotEquals(value byte) Condition

type PropertyByteVector Uses

type PropertyByteVector struct {
    *BaseProperty
}

func (PropertyByteVector) Equals Uses

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

func (PropertyByteVector) GreaterOrEqual Uses

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

func (PropertyByteVector) GreaterThan Uses

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

func (PropertyByteVector) LessOrEqual Uses

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

func (PropertyByteVector) LessThan Uses

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

type PropertyFloat32 Uses

type PropertyFloat32 struct {
    *BaseProperty
}

func (PropertyFloat32) Between Uses

func (property PropertyFloat32) Between(a, b float32) Condition

func (PropertyFloat32) GreaterThan Uses

func (property PropertyFloat32) GreaterThan(value float32) Condition

func (PropertyFloat32) LessThan Uses

func (property PropertyFloat32) LessThan(value float32) Condition

type PropertyFloat64 Uses

type PropertyFloat64 struct {
    *BaseProperty
}

func (PropertyFloat64) Between Uses

func (property PropertyFloat64) Between(a, b float64) Condition

func (PropertyFloat64) GreaterThan Uses

func (property PropertyFloat64) GreaterThan(value float64) Condition

func (PropertyFloat64) LessThan Uses

func (property PropertyFloat64) LessThan(value float64) Condition

type PropertyInt Uses

type PropertyInt struct {
    *BaseProperty
}

func (PropertyInt) Between Uses

func (property PropertyInt) Between(a, b int) Condition

func (PropertyInt) Equals Uses

func (property PropertyInt) Equals(value int) Condition

func (PropertyInt) GreaterThan Uses

func (property PropertyInt) GreaterThan(value int) Condition

func (PropertyInt) In Uses

func (property PropertyInt) In(values ...int) Condition

func (PropertyInt) LessThan Uses

func (property PropertyInt) LessThan(value int) Condition

func (PropertyInt) NotEquals Uses

func (property PropertyInt) NotEquals(value int) Condition

func (PropertyInt) NotIn Uses

func (property PropertyInt) NotIn(values ...int) Condition

type PropertyInt16 Uses

type PropertyInt16 struct {
    *BaseProperty
}

func (PropertyInt16) Between Uses

func (property PropertyInt16) Between(a, b int16) Condition

func (PropertyInt16) Equals Uses

func (property PropertyInt16) Equals(value int16) Condition

func (PropertyInt16) GreaterThan Uses

func (property PropertyInt16) GreaterThan(value int16) Condition

func (PropertyInt16) LessThan Uses

func (property PropertyInt16) LessThan(value int16) Condition

func (PropertyInt16) NotEquals Uses

func (property PropertyInt16) NotEquals(value int16) Condition

type PropertyInt32 Uses

type PropertyInt32 struct {
    *BaseProperty
}

func (PropertyInt32) Between Uses

func (property PropertyInt32) Between(a, b int32) Condition

func (PropertyInt32) Equals Uses

func (property PropertyInt32) Equals(value int32) Condition

func (PropertyInt32) GreaterThan Uses

func (property PropertyInt32) GreaterThan(value int32) Condition

func (PropertyInt32) In Uses

func (property PropertyInt32) In(values ...int32) Condition

func (PropertyInt32) LessThan Uses

func (property PropertyInt32) LessThan(value int32) Condition

func (PropertyInt32) NotEquals Uses

func (property PropertyInt32) NotEquals(value int32) Condition

func (PropertyInt32) NotIn Uses

func (property PropertyInt32) NotIn(values ...int32) Condition

type PropertyInt64 Uses

type PropertyInt64 struct {
    *BaseProperty
}

func (PropertyInt64) Between Uses

func (property PropertyInt64) Between(a, b int64) Condition

func (PropertyInt64) Equals Uses

func (property PropertyInt64) Equals(value int64) Condition

func (PropertyInt64) GreaterThan Uses

func (property PropertyInt64) GreaterThan(value int64) Condition

func (PropertyInt64) In Uses

func (property PropertyInt64) In(values ...int64) Condition

func (PropertyInt64) LessThan Uses

func (property PropertyInt64) LessThan(value int64) Condition

func (PropertyInt64) NotEquals Uses

func (property PropertyInt64) NotEquals(value int64) Condition

func (PropertyInt64) NotIn Uses

func (property PropertyInt64) NotIn(values ...int64) Condition

type PropertyInt8 Uses

type PropertyInt8 struct {
    *BaseProperty
}

func (PropertyInt8) Between Uses

func (property PropertyInt8) Between(a, b int8) Condition

func (PropertyInt8) Equals Uses

func (property PropertyInt8) Equals(value int8) Condition

func (PropertyInt8) GreaterThan Uses

func (property PropertyInt8) GreaterThan(value int8) Condition

func (PropertyInt8) LessThan Uses

func (property PropertyInt8) LessThan(value int8) Condition

func (PropertyInt8) NotEquals Uses

func (property PropertyInt8) NotEquals(value int8) Condition

type PropertyRune Uses

type PropertyRune struct {
    *BaseProperty
}

func (PropertyRune) Between Uses

func (property PropertyRune) Between(a, b rune) Condition

func (PropertyRune) Equals Uses

func (property PropertyRune) Equals(value rune) Condition

func (PropertyRune) GreaterThan Uses

func (property PropertyRune) GreaterThan(value rune) Condition

func (PropertyRune) In Uses

func (property PropertyRune) In(values ...rune) Condition

func (PropertyRune) LessThan Uses

func (property PropertyRune) LessThan(value rune) Condition

func (PropertyRune) NotEquals Uses

func (property PropertyRune) NotEquals(value rune) Condition

func (PropertyRune) NotIn Uses

func (property PropertyRune) NotIn(values ...rune) Condition

type PropertyString Uses

type PropertyString struct {
    *BaseProperty
}

func (PropertyString) Contains Uses

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

func (PropertyString) Equals Uses

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

func (PropertyString) GreaterOrEqual Uses

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

func (PropertyString) GreaterThan Uses

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

func (PropertyString) HasPrefix Uses

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

func (PropertyString) HasSuffix Uses

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

func (PropertyString) In Uses

func (property PropertyString) In(caseSensitive bool, texts ...string) Condition

func (PropertyString) LessOrEqual Uses

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

func (PropertyString) LessThan Uses

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

func (PropertyString) NotEquals Uses

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

type PropertyStringVector Uses

type PropertyStringVector struct {
    *BaseProperty
}

func (PropertyStringVector) Contains Uses

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

type PropertyUint Uses

type PropertyUint struct {
    *BaseProperty
}

func (PropertyUint) Between Uses

func (property PropertyUint) Between(a, b uint) Condition

func (PropertyUint) Equals Uses

func (property PropertyUint) Equals(value uint) Condition

func (PropertyUint) GreaterThan Uses

func (property PropertyUint) GreaterThan(value uint) Condition

func (PropertyUint) In Uses

func (property PropertyUint) In(values ...uint) Condition

func (PropertyUint) LessThan Uses

func (property PropertyUint) LessThan(value uint) Condition

func (PropertyUint) NotEquals Uses

func (property PropertyUint) NotEquals(value uint) Condition

func (PropertyUint) NotIn Uses

func (property PropertyUint) NotIn(values ...uint) Condition

type PropertyUint16 Uses

type PropertyUint16 struct {
    *BaseProperty
}

func (PropertyUint16) Between Uses

func (property PropertyUint16) Between(a, b uint16) Condition

func (PropertyUint16) Equals Uses

func (property PropertyUint16) Equals(value uint16) Condition

func (PropertyUint16) GreaterThan Uses

func (property PropertyUint16) GreaterThan(value uint16) Condition

func (PropertyUint16) LessThan Uses

func (property PropertyUint16) LessThan(value uint16) Condition

func (PropertyUint16) NotEquals Uses

func (property PropertyUint16) NotEquals(value uint16) Condition

type PropertyUint32 Uses

type PropertyUint32 struct {
    *BaseProperty
}

func (PropertyUint32) Between Uses

func (property PropertyUint32) Between(a, b uint32) Condition

func (PropertyUint32) Equals Uses

func (property PropertyUint32) Equals(value uint32) Condition

func (PropertyUint32) GreaterThan Uses

func (property PropertyUint32) GreaterThan(value uint32) Condition

func (PropertyUint32) In Uses

func (property PropertyUint32) In(values ...uint32) Condition

func (PropertyUint32) LessThan Uses

func (property PropertyUint32) LessThan(value uint32) Condition

func (PropertyUint32) NotEquals Uses

func (property PropertyUint32) NotEquals(value uint32) Condition

func (PropertyUint32) NotIn Uses

func (property PropertyUint32) NotIn(values ...uint32) Condition

type PropertyUint64 Uses

type PropertyUint64 struct {
    *BaseProperty
}

func (PropertyUint64) Between Uses

func (property PropertyUint64) Between(a, b uint64) Condition

func (PropertyUint64) Equals Uses

func (property PropertyUint64) Equals(value uint64) Condition

func (PropertyUint64) GreaterThan Uses

func (property PropertyUint64) GreaterThan(value uint64) Condition

func (PropertyUint64) In Uses

func (property PropertyUint64) In(values ...uint64) Condition

func (PropertyUint64) LessThan Uses

func (property PropertyUint64) LessThan(value uint64) Condition

func (PropertyUint64) NotEquals Uses

func (property PropertyUint64) NotEquals(value uint64) Condition

func (PropertyUint64) NotIn Uses

func (property PropertyUint64) NotIn(values ...uint64) Condition

type PropertyUint8 Uses

type PropertyUint8 struct {
    *BaseProperty
}

func (PropertyUint8) Between Uses

func (property PropertyUint8) Between(a, b uint8) Condition

func (PropertyUint8) Equals Uses

func (property PropertyUint8) Equals(value uint8) Condition

func (PropertyUint8) GreaterThan Uses

func (property PropertyUint8) GreaterThan(value uint8) Condition

func (PropertyUint8) LessThan Uses

func (property PropertyUint8) LessThan(value uint8) Condition

func (PropertyUint8) NotEquals Uses

func (property PropertyUint8) NotEquals(value uint8) Condition

type Query Uses

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 Uses

func (query *Query) Close() error

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 Uses

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

Count returns the number of objects matching the query

func (*Query) DescribeParams Uses

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

DescribeParams returns a string representation of the query conditions

func (*Query) Find Uses

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

Find returns all objects matching the query

func (*Query) FindIds Uses

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

FindIds returns IDs of all objects matching the query

func (*Query) Limit Uses

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

Limit sets the number of elements to process by the query

func (*Query) Offset Uses

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 Uses

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

Remove permanently deletes all objects matching the query from the database

func (*Query) SetBytesParams Uses

func (query *Query) SetBytesParams(property Property, values ...[]byte) error

func (*Query) SetFloat64Params Uses

func (query *Query) SetFloat64Params(property Property, values ...float64) error

func (*Query) SetInt32ParamsIn Uses

func (query *Query) SetInt32ParamsIn(property Property, values ...int32) error

func (*Query) SetInt64Params Uses

func (query *Query) SetInt64Params(property Property, values ...int64) error

func (*Query) SetInt64ParamsIn Uses

func (query *Query) SetInt64ParamsIn(property Property, values ...int64) error

func (*Query) SetStringParams Uses

func (query *Query) SetStringParams(property Property, values ...string) error

func (*Query) SetStringParamsIn Uses

func (query *Query) SetStringParamsIn(property Property, values ...string) error

type QueryBuilder Uses

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
}

Internal class; use Box.Query instead. Allows construction of queries; just check queryBuilder.Error or err from Build()

func (*QueryBuilder) All Uses

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

func (*QueryBuilder) Any Uses

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

func (*QueryBuilder) Build Uses

func (qb *QueryBuilder) Build() (*Query, error)

func (*QueryBuilder) BytesEqual Uses

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

func (*QueryBuilder) BytesGreater Uses

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

func (*QueryBuilder) BytesLess Uses

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

func (*QueryBuilder) Close Uses

func (qb *QueryBuilder) Close() error

func (*QueryBuilder) DoubleBetween Uses

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

func (*QueryBuilder) DoubleGreater Uses

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

func (*QueryBuilder) DoubleLess Uses

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

func (*QueryBuilder) Int32In Uses

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

func (*QueryBuilder) Int32NotIn Uses

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

func (*QueryBuilder) Int64In Uses

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

func (*QueryBuilder) Int64NotIn Uses

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

func (*QueryBuilder) IntBetween Uses

func (qb *QueryBuilder) IntBetween(property *BaseProperty, value1 int64, value2 int64) (ConditionId, error)

func (*QueryBuilder) IntEqual Uses

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

func (*QueryBuilder) IntGreater Uses

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

func (*QueryBuilder) IntLess Uses

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

func (*QueryBuilder) IntNotEqual Uses

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

func (*QueryBuilder) LinkManyToMany Uses

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

func (*QueryBuilder) LinkOneToMany Uses

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

func (*QueryBuilder) NotNull Uses

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

func (*QueryBuilder) Null Uses

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

func (*QueryBuilder) StringContains Uses

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

func (*QueryBuilder) StringEquals Uses

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

func (*QueryBuilder) StringGreater Uses

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

func (*QueryBuilder) StringHasPrefix Uses

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

func (*QueryBuilder) StringHasSuffix Uses

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

func (*QueryBuilder) StringIn Uses

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

func (*QueryBuilder) StringLess Uses

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

func (*QueryBuilder) StringNotEquals Uses

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

func (*QueryBuilder) StringVectorContains Uses

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

type RelationToMany Uses

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

type RelationToOne Uses

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 Uses

func (relation RelationToOne) Equals(value uint64) Condition

func (RelationToOne) In Uses

func (relation RelationToOne) In(values ...uint64) Condition
func (relation *RelationToOne) Link(conditions ...Condition) Condition

func (RelationToOne) NotEquals Uses

func (relation RelationToOne) NotEquals(value uint64) Condition

func (RelationToOne) NotIn Uses

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

type Transaction Uses

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

Internal: won't be publicly exposed in a future version!

func (*Transaction) Abort Uses

func (txn *Transaction) Abort() error

func (*Transaction) Close Uses

func (txn *Transaction) Close() error

func (*Transaction) Commit Uses

func (txn *Transaction) Commit() error

func (*Transaction) RunWithCursor Uses

func (txn *Transaction) RunWithCursor(entityId TypeId, cursorFun cursorFun) error

Internal: won't be available in future versions

type TypeId Uses

type TypeId uint32

type Version Uses

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

If you depend on a certain version of ObjectBox, you can check using this struct. See also VersionGo() and VersionLib().

func VersionGo Uses

func VersionGo() Version

ObjectBox Version Go

func VersionLib Uses

func VersionLib() Version

Version of the dynamic linked ObjectBox library

func (Version) String Uses

func (v Version) String() string

Directories

PathSynopsis
fbutilsPackage fbutils provides utilities for the FlatBuffers in ObjectBox

Package objectbox imports 12 packages (graph). Updated 2019-02-22. Refresh now. Tools for package owners.