model

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EntityBinding = entity_EntityInfo{
	Entity: objectbox.Entity{
		Id: 1,
	},
	Uid: 3022148985475790732,
}
View Source
var EntityByValueBinding = entityByValue_EntityInfo{
	Entity: objectbox.Entity{
		Id: 3,
	},
	Uid: 2793387980842421409,
}
View Source
var EntityByValue_ = struct {
	Id   *objectbox.PropertyUint64
	Text *objectbox.PropertyString
}{
	Id: &objectbox.PropertyUint64{
		BaseProperty: &objectbox.BaseProperty{
			Id:     1,
			Entity: &EntityByValueBinding.Entity,
		},
	},
	Text: &objectbox.PropertyString{
		BaseProperty: &objectbox.BaseProperty{
			Id:     2,
			Entity: &EntityByValueBinding.Entity,
		},
	},
}

EntityByValue_ contains type-based Property helpers to facilitate some common operations such as Queries.

View Source
var Entity_ = struct {
	Id              *objectbox.PropertyUint64
	Int             *objectbox.PropertyInt
	Int8            *objectbox.PropertyInt8
	Int16           *objectbox.PropertyInt16
	Int32           *objectbox.PropertyInt32
	Int64           *objectbox.PropertyInt64
	Uint            *objectbox.PropertyUint
	Uint8           *objectbox.PropertyUint8
	Uint16          *objectbox.PropertyUint16
	Uint32          *objectbox.PropertyUint32
	Uint64          *objectbox.PropertyUint64
	Bool            *objectbox.PropertyBool
	String          *objectbox.PropertyString
	Byte            *objectbox.PropertyByte
	ByteVector      *objectbox.PropertyByteVector
	Rune            *objectbox.PropertyRune
	Float32         *objectbox.PropertyFloat32
	Float64         *objectbox.PropertyFloat64
	Date            *objectbox.PropertyInt64
	Complex128      *objectbox.PropertyByteVector
	StringVector    *objectbox.PropertyStringVector
	Related         *objectbox.RelationToOne
	RelatedPtr      *objectbox.RelationToOne
	RelatedPtr2     *objectbox.RelationToOne
	IntPtr          *objectbox.PropertyInt
	Int8Ptr         *objectbox.PropertyInt8
	Int16Ptr        *objectbox.PropertyInt16
	Int32Ptr        *objectbox.PropertyInt32
	Int64Ptr        *objectbox.PropertyInt64
	UintPtr         *objectbox.PropertyUint
	Uint8Ptr        *objectbox.PropertyUint8
	Uint16Ptr       *objectbox.PropertyUint16
	Uint32Ptr       *objectbox.PropertyUint32
	Uint64Ptr       *objectbox.PropertyUint64
	BoolPtr         *objectbox.PropertyBool
	StringPtr       *objectbox.PropertyString
	BytePtr         *objectbox.PropertyByte
	RunePtr         *objectbox.PropertyRune
	Float32Ptr      *objectbox.PropertyFloat32
	Float64Ptr      *objectbox.PropertyFloat64
	StringVectorPtr *objectbox.PropertyStringVector
	ByteVectorPtr   *objectbox.PropertyByteVector
	RelatedSlice    *objectbox.RelationToMany
	RelatedPtrSlice *objectbox.RelationToMany
}{
	Id: &objectbox.PropertyUint64{
		BaseProperty: &objectbox.BaseProperty{
			Id:     1,
			Entity: &EntityBinding.Entity,
		},
	},
	Int: &objectbox.PropertyInt{
		BaseProperty: &objectbox.BaseProperty{
			Id:     2,
			Entity: &EntityBinding.Entity,
		},
	},
	Int8: &objectbox.PropertyInt8{
		BaseProperty: &objectbox.BaseProperty{
			Id:     3,
			Entity: &EntityBinding.Entity,
		},
	},
	Int16: &objectbox.PropertyInt16{
		BaseProperty: &objectbox.BaseProperty{
			Id:     4,
			Entity: &EntityBinding.Entity,
		},
	},
	Int32: &objectbox.PropertyInt32{
		BaseProperty: &objectbox.BaseProperty{
			Id:     5,
			Entity: &EntityBinding.Entity,
		},
	},
	Int64: &objectbox.PropertyInt64{
		BaseProperty: &objectbox.BaseProperty{
			Id:     6,
			Entity: &EntityBinding.Entity,
		},
	},
	Uint: &objectbox.PropertyUint{
		BaseProperty: &objectbox.BaseProperty{
			Id:     7,
			Entity: &EntityBinding.Entity,
		},
	},
	Uint8: &objectbox.PropertyUint8{
		BaseProperty: &objectbox.BaseProperty{
			Id:     8,
			Entity: &EntityBinding.Entity,
		},
	},
	Uint16: &objectbox.PropertyUint16{
		BaseProperty: &objectbox.BaseProperty{
			Id:     9,
			Entity: &EntityBinding.Entity,
		},
	},
	Uint32: &objectbox.PropertyUint32{
		BaseProperty: &objectbox.BaseProperty{
			Id:     10,
			Entity: &EntityBinding.Entity,
		},
	},
	Uint64: &objectbox.PropertyUint64{
		BaseProperty: &objectbox.BaseProperty{
			Id:     11,
			Entity: &EntityBinding.Entity,
		},
	},
	Bool: &objectbox.PropertyBool{
		BaseProperty: &objectbox.BaseProperty{
			Id:     12,
			Entity: &EntityBinding.Entity,
		},
	},
	String: &objectbox.PropertyString{
		BaseProperty: &objectbox.BaseProperty{
			Id:     13,
			Entity: &EntityBinding.Entity,
		},
	},
	Byte: &objectbox.PropertyByte{
		BaseProperty: &objectbox.BaseProperty{
			Id:     14,
			Entity: &EntityBinding.Entity,
		},
	},
	ByteVector: &objectbox.PropertyByteVector{
		BaseProperty: &objectbox.BaseProperty{
			Id:     15,
			Entity: &EntityBinding.Entity,
		},
	},
	Rune: &objectbox.PropertyRune{
		BaseProperty: &objectbox.BaseProperty{
			Id:     16,
			Entity: &EntityBinding.Entity,
		},
	},
	Float32: &objectbox.PropertyFloat32{
		BaseProperty: &objectbox.BaseProperty{
			Id:     17,
			Entity: &EntityBinding.Entity,
		},
	},
	Float64: &objectbox.PropertyFloat64{
		BaseProperty: &objectbox.BaseProperty{
			Id:     18,
			Entity: &EntityBinding.Entity,
		},
	},
	Date: &objectbox.PropertyInt64{
		BaseProperty: &objectbox.BaseProperty{
			Id:     19,
			Entity: &EntityBinding.Entity,
		},
	},
	Complex128: &objectbox.PropertyByteVector{
		BaseProperty: &objectbox.BaseProperty{
			Id:     20,
			Entity: &EntityBinding.Entity,
		},
	},
	StringVector: &objectbox.PropertyStringVector{
		BaseProperty: &objectbox.BaseProperty{
			Id:     21,
			Entity: &EntityBinding.Entity,
		},
	},
	Related: &objectbox.RelationToOne{
		Property: &objectbox.BaseProperty{
			Id:     22,
			Entity: &EntityBinding.Entity,
		},
		Target: &TestEntityRelatedBinding.Entity,
	},
	RelatedPtr: &objectbox.RelationToOne{
		Property: &objectbox.BaseProperty{
			Id:     23,
			Entity: &EntityBinding.Entity,
		},
		Target: &TestEntityRelatedBinding.Entity,
	},
	RelatedPtr2: &objectbox.RelationToOne{
		Property: &objectbox.BaseProperty{
			Id:     24,
			Entity: &EntityBinding.Entity,
		},
		Target: &TestEntityRelatedBinding.Entity,
	},
	IntPtr: &objectbox.PropertyInt{
		BaseProperty: &objectbox.BaseProperty{
			Id:     25,
			Entity: &EntityBinding.Entity,
		},
	},
	Int8Ptr: &objectbox.PropertyInt8{
		BaseProperty: &objectbox.BaseProperty{
			Id:     26,
			Entity: &EntityBinding.Entity,
		},
	},
	Int16Ptr: &objectbox.PropertyInt16{
		BaseProperty: &objectbox.BaseProperty{
			Id:     27,
			Entity: &EntityBinding.Entity,
		},
	},
	Int32Ptr: &objectbox.PropertyInt32{
		BaseProperty: &objectbox.BaseProperty{
			Id:     28,
			Entity: &EntityBinding.Entity,
		},
	},
	Int64Ptr: &objectbox.PropertyInt64{
		BaseProperty: &objectbox.BaseProperty{
			Id:     29,
			Entity: &EntityBinding.Entity,
		},
	},
	UintPtr: &objectbox.PropertyUint{
		BaseProperty: &objectbox.BaseProperty{
			Id:     30,
			Entity: &EntityBinding.Entity,
		},
	},
	Uint8Ptr: &objectbox.PropertyUint8{
		BaseProperty: &objectbox.BaseProperty{
			Id:     31,
			Entity: &EntityBinding.Entity,
		},
	},
	Uint16Ptr: &objectbox.PropertyUint16{
		BaseProperty: &objectbox.BaseProperty{
			Id:     32,
			Entity: &EntityBinding.Entity,
		},
	},
	Uint32Ptr: &objectbox.PropertyUint32{
		BaseProperty: &objectbox.BaseProperty{
			Id:     33,
			Entity: &EntityBinding.Entity,
		},
	},
	Uint64Ptr: &objectbox.PropertyUint64{
		BaseProperty: &objectbox.BaseProperty{
			Id:     34,
			Entity: &EntityBinding.Entity,
		},
	},
	BoolPtr: &objectbox.PropertyBool{
		BaseProperty: &objectbox.BaseProperty{
			Id:     35,
			Entity: &EntityBinding.Entity,
		},
	},
	StringPtr: &objectbox.PropertyString{
		BaseProperty: &objectbox.BaseProperty{
			Id:     36,
			Entity: &EntityBinding.Entity,
		},
	},
	BytePtr: &objectbox.PropertyByte{
		BaseProperty: &objectbox.BaseProperty{
			Id:     38,
			Entity: &EntityBinding.Entity,
		},
	},
	RunePtr: &objectbox.PropertyRune{
		BaseProperty: &objectbox.BaseProperty{
			Id:     40,
			Entity: &EntityBinding.Entity,
		},
	},
	Float32Ptr: &objectbox.PropertyFloat32{
		BaseProperty: &objectbox.BaseProperty{
			Id:     41,
			Entity: &EntityBinding.Entity,
		},
	},
	Float64Ptr: &objectbox.PropertyFloat64{
		BaseProperty: &objectbox.BaseProperty{
			Id:     42,
			Entity: &EntityBinding.Entity,
		},
	},
	StringVectorPtr: &objectbox.PropertyStringVector{
		BaseProperty: &objectbox.BaseProperty{
			Id:     43,
			Entity: &EntityBinding.Entity,
		},
	},
	ByteVectorPtr: &objectbox.PropertyByteVector{
		BaseProperty: &objectbox.BaseProperty{
			Id:     44,
			Entity: &EntityBinding.Entity,
		},
	},
	RelatedSlice: &objectbox.RelationToMany{
		Id:     4,
		Source: &EntityBinding.Entity,
		Target: &EntityByValueBinding.Entity,
	},
	RelatedPtrSlice: &objectbox.RelationToMany{
		Id:     5,
		Source: &EntityBinding.Entity,
		Target: &TestEntityRelatedBinding.Entity,
	},
}

Entity_ contains type-based Property helpers to facilitate some common operations such as Queries.

View Source
var TSDateBinding = tSDate_EntityInfo{
	Entity: objectbox.Entity{
		Id: 6,
	},
	Uid: 2767047163049667536,
}
View Source
var TSDateNanoBinding = tSDateNano_EntityInfo{
	Entity: objectbox.Entity{
		Id: 7,
	},
	Uid: 8200223062288330287,
}
View Source
var TSDateNano_ = struct {
	Id   *objectbox.PropertyUint64
	Time *objectbox.PropertyInt64
}{
	Id: &objectbox.PropertyUint64{
		BaseProperty: &objectbox.BaseProperty{
			Id:     1,
			Entity: &TSDateNanoBinding.Entity,
		},
	},
	Time: &objectbox.PropertyInt64{
		BaseProperty: &objectbox.BaseProperty{
			Id:     2,
			Entity: &TSDateNanoBinding.Entity,
		},
	},
}

TSDateNano_ contains type-based Property helpers to facilitate some common operations such as Queries.

View Source
var TSDate_ = struct {
	Id   *objectbox.PropertyUint64
	Time *objectbox.PropertyInt64
}{
	Id: &objectbox.PropertyUint64{
		BaseProperty: &objectbox.BaseProperty{
			Id:     1,
			Entity: &TSDateBinding.Entity,
		},
	},
	Time: &objectbox.PropertyInt64{
		BaseProperty: &objectbox.BaseProperty{
			Id:     2,
			Entity: &TSDateBinding.Entity,
		},
	},
}

TSDate_ contains type-based Property helpers to facilitate some common operations such as Queries.

View Source
var TestEntityInlineBinding = testEntityInline_EntityInfo{
	Entity: objectbox.Entity{
		Id: 4,
	},
	Uid: 7566870022778519807,
}
View Source
var TestEntityInline_ = struct {
	Date  *objectbox.PropertyInt64
	Value *objectbox.PropertyFloat64
	Id    *objectbox.PropertyUint64
}{
	Date: &objectbox.PropertyInt64{
		BaseProperty: &objectbox.BaseProperty{
			Id:     1,
			Entity: &TestEntityInlineBinding.Entity,
		},
	},
	Value: &objectbox.PropertyFloat64{
		BaseProperty: &objectbox.BaseProperty{
			Id:     2,
			Entity: &TestEntityInlineBinding.Entity,
		},
	},
	Id: &objectbox.PropertyUint64{
		BaseProperty: &objectbox.BaseProperty{
			Id:     3,
			Entity: &TestEntityInlineBinding.Entity,
		},
	},
}

TestEntityInline_ contains type-based Property helpers to facilitate some common operations such as Queries.

View Source
var TestEntityRelatedBinding = testEntityRelated_EntityInfo{
	Entity: objectbox.Entity{
		Id: 5,
	},
	Uid: 145948658381494339,
}
View Source
var TestEntityRelated_ = struct {
	Id        *objectbox.PropertyUint64
	Name      *objectbox.PropertyString
	Next      *objectbox.RelationToOne
	NextSlice *objectbox.RelationToMany
}{
	Id: &objectbox.PropertyUint64{
		BaseProperty: &objectbox.BaseProperty{
			Id:     1,
			Entity: &TestEntityRelatedBinding.Entity,
		},
	},
	Name: &objectbox.PropertyString{
		BaseProperty: &objectbox.BaseProperty{
			Id:     2,
			Entity: &TestEntityRelatedBinding.Entity,
		},
	},
	Next: &objectbox.RelationToOne{
		Property: &objectbox.BaseProperty{
			Id:     3,
			Entity: &TestEntityRelatedBinding.Entity,
		},
		Target: &EntityByValueBinding.Entity,
	},
	NextSlice: &objectbox.RelationToMany{
		Id:     6,
		Source: &TestEntityRelatedBinding.Entity,
		Target: &EntityByValueBinding.Entity,
	},
}

TestEntityRelated_ contains type-based Property helpers to facilitate some common operations such as Queries.

View Source
var TestEntitySyncedBinding = testEntitySynced_EntityInfo{
	Entity: objectbox.Entity{
		Id: 8,
	},
	Uid: 1967687883385423038,
}
View Source
var TestEntitySynced_ = struct {
	Id   *objectbox.PropertyUint64
	Name *objectbox.PropertyString
}{
	Id: &objectbox.PropertyUint64{
		BaseProperty: &objectbox.BaseProperty{
			Id:     1,
			Entity: &TestEntitySyncedBinding.Entity,
		},
	},
	Name: &objectbox.PropertyString{
		BaseProperty: &objectbox.BaseProperty{
			Id:     2,
			Entity: &TestEntitySyncedBinding.Entity,
		},
	},
}

TestEntitySynced_ contains type-based Property helpers to facilitate some common operations such as Queries.

View Source
var TestStringIdEntityBinding = testStringIdEntity_EntityInfo{
	Entity: objectbox.Entity{
		Id: 2,
	},
	Uid: 5412225159475839048,
}
View Source
var TestStringIdEntity_ = struct {
	Id *objectbox.PropertyUint64
}{
	Id: &objectbox.PropertyUint64{
		BaseProperty: &objectbox.BaseProperty{
			Id:     1,
			Entity: &TestStringIdEntityBinding.Entity,
		},
	},
}

TestStringIdEntity_ contains type-based Property helpers to facilitate some common operations such as Queries.

Functions

func ObjectBoxModel

func ObjectBoxModel() *objectbox.Model

ObjectBoxModel declares and builds the model from all the entities in the package. It is usually used when setting-up ObjectBox as an argument to the Builder.Model() function.

Types

type BaseWithDate added in v0.9.0

type BaseWithDate struct {
	Date int64 `objectbox:"date"`
}

BaseWithDate model

type BaseWithValue added in v0.9.0

type BaseWithValue struct {
	Value float64
}

BaseWithValue model

type Entity

type Entity struct {
	// base types
	Id           uint64
	Int          int
	Int8         int8
	Int16        int16
	Int32        int32
	Int64        int64
	Uint         uint
	Uint8        uint8
	Uint16       uint16
	Uint32       uint32
	Uint64       uint64
	Bool         bool
	String       string
	StringVector []string
	Byte         byte
	ByteVector   []byte
	Rune         rune
	Float32      float32
	Float64      float64

	// converters
	Date       time.Time  `objectbox:"date"`
	Complex128 complex128 `objectbox:"type:[]byte converter:complex128Bytes"`

	// one-to-many relations
	Related     TestEntityRelated  `objectbox:"link"`
	RelatedPtr  *TestEntityRelated `objectbox:"link"`
	RelatedPtr2 *TestEntityRelated `objectbox:"link"`

	// many-to-many relations
	RelatedSlice    []EntityByValue
	RelatedPtrSlice []*TestEntityRelated `objectbox:"lazy"`

	IntPtr          *int
	Int8Ptr         *int8
	Int16Ptr        *int16
	Int32Ptr        *int32
	Int64Ptr        *int64
	UintPtr         *uint
	Uint8Ptr        *uint8
	Uint16Ptr       *uint16
	Uint32Ptr       *uint32
	Uint64Ptr       *uint64
	BoolPtr         *bool
	StringPtr       *string
	StringVectorPtr *[]string
	BytePtr         *byte
	ByteVectorPtr   *[]byte
	RunePtr         *rune
	Float32Ptr      *float32
	Float64Ptr      *float64
}

Entity model for tests

func Entity47

func Entity47() *Entity

Entity47 creates a test entity ("47" because int fields are multiples of 47)

type EntityAsyncBox added in v1.1.0

type EntityAsyncBox struct {
	*objectbox.AsyncBox
}

EntityAsyncBox provides asynchronous operations on Entity objects.

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 AsyncBoxForEntity added in v1.1.0

func AsyncBoxForEntity(ob *objectbox.ObjectBox, timeoutMs uint64) *EntityAsyncBox

AsyncBoxForEntity 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 EntityBox::Async() which takes care of resource management and doesn't require closing.

func (*EntityAsyncBox) Insert added in v1.1.0

func (asyncBox *EntityAsyncBox) Insert(object *Entity) (id uint64, err error)

Insert a single object asynchronously. The Id property on the passed object will be assigned the 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 (*EntityAsyncBox) Put added in v1.1.0

func (asyncBox *EntityAsyncBox) Put(object *Entity) (uint64, error)

Put inserts/updates a single object asynchronously. When inserting a new object, the Id property on the passed object will be assigned the 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 (*EntityAsyncBox) Remove added in v1.1.0

func (asyncBox *EntityAsyncBox) Remove(object *Entity) error

Remove deletes a single object asynchronously.

func (*EntityAsyncBox) Update added in v1.1.0

func (asyncBox *EntityAsyncBox) Update(object *Entity) error

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

type EntityBox

type EntityBox struct {
	*objectbox.Box
}

Box provides CRUD access to Entity objects

func BoxForEntity

func BoxForEntity(ob *objectbox.ObjectBox) *EntityBox

BoxForEntity opens a box of Entity objects

func (*EntityBox) Async added in v1.1.0

func (box *EntityBox) Async() *EntityAsyncBox

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

func (*EntityBox) FetchRelatedPtrSlice added in v1.0.0

func (box *EntityBox) FetchRelatedPtrSlice(sourceObjects ...*Entity) error

FetchRelatedPtrSlice reads target objects for relation Entity::RelatedPtrSlice. It will "GetManyExisting()" all related TestEntityRelated objects for each source object and set sourceObject.RelatedPtrSlice to the slice of related objects, as currently stored in DB.

func (*EntityBox) Get

func (box *EntityBox) Get(id uint64) (*Entity, error)

Get reads a single object.

Returns nil (and no error) in case the object with the given ID doesn't exist.

func (*EntityBox) GetAll

func (box *EntityBox) GetAll() ([]*Entity, error)

GetAll reads all stored objects

func (*EntityBox) GetMany added in v1.0.0

func (box *EntityBox) GetMany(ids ...uint64) ([]*Entity, error)

GetMany reads multiple objects at once. If any of the objects doesn't exist, its position in the return slice is nil

func (*EntityBox) GetManyExisting added in v1.1.0

func (box *EntityBox) GetManyExisting(ids ...uint64) ([]*Entity, error)

GetManyExisting reads multiple objects at once, skipping those that do not exist.

func (*EntityBox) Insert added in v1.1.0

func (box *EntityBox) Insert(object *Entity) (uint64, error)

Insert synchronously inserts a single object. As opposed to Put, Insert will fail if given an ID that already exists. In case the Id is not specified, it would be assigned automatically (auto-increment). When inserting, the Entity.Id property on the passed object will be assigned the new ID as well.

func (*EntityBox) Put

func (box *EntityBox) Put(object *Entity) (uint64, 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 Entity.Id property on the passed object will be assigned the new ID as well.

func (*EntityBox) PutAsync

func (box *EntityBox) PutAsync(object *Entity) (uint64, error)

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

func (*EntityBox) PutMany added in v1.0.0

func (box *EntityBox) PutMany(objects []*Entity) ([]uint64, error)

PutMany inserts multiple objects in single transaction. 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). When inserting, the Entity.Id property on the objects in the slice will be assigned the new IDs as well.

Note: In case an error occurs during the transaction, some of the objects may already have the Entity.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 (*EntityBox) Query

func (box *EntityBox) Query(conditions ...objectbox.Condition) *EntityQuery

Creates a query with the given conditions. Use the fields of the Entity_ struct to create conditions. Keep the *EntityQuery if you intend to execute the query 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 (*EntityBox) QueryOrError

func (box *EntityBox) QueryOrError(conditions ...objectbox.Condition) (*EntityQuery, error)

Creates a query with the given conditions. Use the fields of the Entity_ struct to create conditions. Keep the *EntityQuery if you intend to execute the query multiple times.

func (*EntityBox) Remove

func (box *EntityBox) Remove(object *Entity) error

Remove deletes a single object

func (*EntityBox) RemoveMany added in v1.0.0

func (box *EntityBox) RemoveMany(objects ...*Entity) (uint64, error)

RemoveMany 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 (*EntityBox) Update added in v1.1.0

func (box *EntityBox) Update(object *Entity) 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 EntityByValue added in v0.9.0

type EntityByValue struct {
	Id   uint64
	Text string
}

EntityByValue model

type EntityByValueAsyncBox added in v1.1.0

type EntityByValueAsyncBox struct {
	*objectbox.AsyncBox
}

EntityByValueAsyncBox provides asynchronous operations on EntityByValue objects.

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 AsyncBoxForEntityByValue added in v1.1.0

func AsyncBoxForEntityByValue(ob *objectbox.ObjectBox, timeoutMs uint64) *EntityByValueAsyncBox

AsyncBoxForEntityByValue 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 EntityByValueBox::Async() which takes care of resource management and doesn't require closing.

func (*EntityByValueAsyncBox) Insert added in v1.1.0

func (asyncBox *EntityByValueAsyncBox) Insert(object *EntityByValue) (id uint64, err error)

Insert a single object asynchronously. The Id property on the passed object will be assigned the 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 (*EntityByValueAsyncBox) Put added in v1.1.0

func (asyncBox *EntityByValueAsyncBox) Put(object *EntityByValue) (uint64, error)

Put inserts/updates a single object asynchronously. When inserting a new object, the Id property on the passed object will be assigned the 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 (*EntityByValueAsyncBox) Remove added in v1.1.0

func (asyncBox *EntityByValueAsyncBox) Remove(object *EntityByValue) error

Remove deletes a single object asynchronously.

func (*EntityByValueAsyncBox) Update added in v1.1.0

func (asyncBox *EntityByValueAsyncBox) Update(object *EntityByValue) error

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

type EntityByValueBox added in v0.9.0

type EntityByValueBox struct {
	*objectbox.Box
}

Box provides CRUD access to EntityByValue objects

func BoxForEntityByValue added in v0.9.0

func BoxForEntityByValue(ob *objectbox.ObjectBox) *EntityByValueBox

BoxForEntityByValue opens a box of EntityByValue objects

func (*EntityByValueBox) Async added in v1.1.0

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

func (*EntityByValueBox) Get added in v0.9.0

func (box *EntityByValueBox) Get(id uint64) (*EntityByValue, error)

Get reads a single object.

Returns nil (and no error) in case the object with the given ID doesn't exist.

func (*EntityByValueBox) GetAll added in v0.9.0

func (box *EntityByValueBox) GetAll() ([]EntityByValue, error)

GetAll reads all stored objects

func (*EntityByValueBox) GetMany added in v1.0.0

func (box *EntityByValueBox) GetMany(ids ...uint64) ([]EntityByValue, error)

GetMany reads multiple objects at once. If any of the objects doesn't exist, its position in the return slice is an empty object

func (*EntityByValueBox) GetManyExisting added in v1.1.0

func (box *EntityByValueBox) GetManyExisting(ids ...uint64) ([]EntityByValue, error)

GetManyExisting reads multiple objects at once, skipping those that do not exist.

func (*EntityByValueBox) Insert added in v1.1.0

func (box *EntityByValueBox) Insert(object *EntityByValue) (uint64, error)

Insert synchronously inserts a single object. As opposed to Put, Insert will fail if given an ID that already exists. In case the Id is not specified, it would be assigned automatically (auto-increment). When inserting, the EntityByValue.Id property on the passed object will be assigned the new ID as well.

func (*EntityByValueBox) Put added in v0.9.0

func (box *EntityByValueBox) Put(object *EntityByValue) (uint64, 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 EntityByValue.Id property on the passed object will be assigned the new ID as well.

func (*EntityByValueBox) PutAsync added in v0.9.0

func (box *EntityByValueBox) PutAsync(object *EntityByValue) (uint64, error)

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

func (*EntityByValueBox) PutMany added in v1.0.0

func (box *EntityByValueBox) PutMany(objects []EntityByValue) ([]uint64, error)

PutMany inserts multiple objects in single transaction. 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). When inserting, the EntityByValue.Id property on the objects in the slice will be assigned the new IDs as well.

Note: In case an error occurs during the transaction, some of the objects may already have the EntityByValue.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 (*EntityByValueBox) Query added in v0.9.0

func (box *EntityByValueBox) Query(conditions ...objectbox.Condition) *EntityByValueQuery

Creates a query with the given conditions. Use the fields of the EntityByValue_ struct to create conditions. Keep the *EntityByValueQuery if you intend to execute the query 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 (*EntityByValueBox) QueryOrError added in v0.9.0

func (box *EntityByValueBox) QueryOrError(conditions ...objectbox.Condition) (*EntityByValueQuery, error)

Creates a query with the given conditions. Use the fields of the EntityByValue_ struct to create conditions. Keep the *EntityByValueQuery if you intend to execute the query multiple times.

func (*EntityByValueBox) Remove added in v0.9.0

func (box *EntityByValueBox) Remove(object *EntityByValue) error

Remove deletes a single object

func (*EntityByValueBox) RemoveMany added in v1.0.0

func (box *EntityByValueBox) RemoveMany(objects ...*EntityByValue) (uint64, error)

RemoveMany 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 (*EntityByValueBox) Update added in v1.1.0

func (box *EntityByValueBox) Update(object *EntityByValue) 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 EntityByValueQuery added in v0.9.0

type EntityByValueQuery struct {
	*objectbox.Query
}

Query provides a way to search stored objects

For example, you can find all EntityByValue which Id is either 42 or 47:

box.Query(EntityByValue_.Id.In(42, 47)).Find()

func (*EntityByValueQuery) Find added in v0.9.0

func (query *EntityByValueQuery) Find() ([]EntityByValue, error)

Find returns all objects matching the query

func (*EntityByValueQuery) Limit added in v0.9.0

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

Limit sets the number of elements to process by the query

func (*EntityByValueQuery) Offset added in v0.9.0

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

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

type EntityQuery

type EntityQuery struct {
	*objectbox.Query
}

Query provides a way to search stored objects

For example, you can find all Entity which Id is either 42 or 47:

box.Query(Entity_.Id.In(42, 47)).Find()

func (*EntityQuery) Find

func (query *EntityQuery) Find() ([]*Entity, error)

Find returns all objects matching the query

func (*EntityQuery) Limit added in v0.9.0

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

Limit sets the number of elements to process by the query

func (*EntityQuery) Offset added in v0.9.0

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

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

type TSDate added in v1.4.0

type TSDate struct {
	Id   uint64
	Time time.Time `objectbox:"id-companion,date"`
}

type TSDateAsyncBox added in v1.4.0

type TSDateAsyncBox struct {
	*objectbox.AsyncBox
}

TSDateAsyncBox provides asynchronous operations on TSDate objects.

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 AsyncBoxForTSDate added in v1.4.0

func AsyncBoxForTSDate(ob *objectbox.ObjectBox, timeoutMs uint64) *TSDateAsyncBox

AsyncBoxForTSDate 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 TSDateBox::Async() which takes care of resource management and doesn't require closing.

func (*TSDateAsyncBox) Insert added in v1.4.0

func (asyncBox *TSDateAsyncBox) Insert(object *TSDate) (id uint64, err error)

Insert a single object asynchronously. The Id property on the passed object will be assigned the 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 (*TSDateAsyncBox) Put added in v1.4.0

func (asyncBox *TSDateAsyncBox) Put(object *TSDate) (uint64, error)

Put inserts/updates a single object asynchronously. When inserting a new object, the Id property on the passed object will be assigned the 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 (*TSDateAsyncBox) Remove added in v1.4.0

func (asyncBox *TSDateAsyncBox) Remove(object *TSDate) error

Remove deletes a single object asynchronously.

func (*TSDateAsyncBox) Update added in v1.4.0

func (asyncBox *TSDateAsyncBox) Update(object *TSDate) error

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

type TSDateBox added in v1.4.0

type TSDateBox struct {
	*objectbox.Box
}

Box provides CRUD access to TSDate objects

func BoxForTSDate added in v1.4.0

func BoxForTSDate(ob *objectbox.ObjectBox) *TSDateBox

BoxForTSDate opens a box of TSDate objects

func (*TSDateBox) Async added in v1.4.0

func (box *TSDateBox) Async() *TSDateAsyncBox

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

func (*TSDateBox) Get added in v1.4.0

func (box *TSDateBox) Get(id uint64) (*TSDate, error)

Get reads a single object.

Returns nil (and no error) in case the object with the given ID doesn't exist.

func (*TSDateBox) GetAll added in v1.4.0

func (box *TSDateBox) GetAll() ([]*TSDate, error)

GetAll reads all stored objects

func (*TSDateBox) GetMany added in v1.4.0

func (box *TSDateBox) GetMany(ids ...uint64) ([]*TSDate, error)

GetMany reads multiple objects at once. If any of the objects doesn't exist, its position in the return slice is nil

func (*TSDateBox) GetManyExisting added in v1.4.0

func (box *TSDateBox) GetManyExisting(ids ...uint64) ([]*TSDate, error)

GetManyExisting reads multiple objects at once, skipping those that do not exist.

func (*TSDateBox) Insert added in v1.4.0

func (box *TSDateBox) Insert(object *TSDate) (uint64, error)

Insert synchronously inserts a single object. As opposed to Put, Insert will fail if given an ID that already exists. In case the Id is not specified, it would be assigned automatically (auto-increment). When inserting, the TSDate.Id property on the passed object will be assigned the new ID as well.

func (*TSDateBox) Put added in v1.4.0

func (box *TSDateBox) Put(object *TSDate) (uint64, 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 TSDate.Id property on the passed object will be assigned the new ID as well.

func (*TSDateBox) PutAsync added in v1.4.0

func (box *TSDateBox) PutAsync(object *TSDate) (uint64, error)

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

func (*TSDateBox) PutMany added in v1.4.0

func (box *TSDateBox) PutMany(objects []*TSDate) ([]uint64, error)

PutMany inserts multiple objects in single transaction. 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). When inserting, the TSDate.Id property on the objects in the slice will be assigned the new IDs as well.

Note: In case an error occurs during the transaction, some of the objects may already have the TSDate.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 (*TSDateBox) Query added in v1.4.0

func (box *TSDateBox) Query(conditions ...objectbox.Condition) *TSDateQuery

Creates a query with the given conditions. Use the fields of the TSDate_ struct to create conditions. Keep the *TSDateQuery if you intend to execute the query 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 (*TSDateBox) QueryOrError added in v1.4.0

func (box *TSDateBox) QueryOrError(conditions ...objectbox.Condition) (*TSDateQuery, error)

Creates a query with the given conditions. Use the fields of the TSDate_ struct to create conditions. Keep the *TSDateQuery if you intend to execute the query multiple times.

func (*TSDateBox) Remove added in v1.4.0

func (box *TSDateBox) Remove(object *TSDate) error

Remove deletes a single object

func (*TSDateBox) RemoveMany added in v1.4.0

func (box *TSDateBox) RemoveMany(objects ...*TSDate) (uint64, error)

RemoveMany 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 (*TSDateBox) Update added in v1.4.0

func (box *TSDateBox) Update(object *TSDate) 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 TSDateNano added in v1.4.0

type TSDateNano struct {
	Id   uint64
	Time time.Time `objectbox:"id-companion,date-nano"`
}

type TSDateNanoAsyncBox added in v1.4.0

type TSDateNanoAsyncBox struct {
	*objectbox.AsyncBox
}

TSDateNanoAsyncBox provides asynchronous operations on TSDateNano objects.

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 AsyncBoxForTSDateNano added in v1.4.0

func AsyncBoxForTSDateNano(ob *objectbox.ObjectBox, timeoutMs uint64) *TSDateNanoAsyncBox

AsyncBoxForTSDateNano 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 TSDateNanoBox::Async() which takes care of resource management and doesn't require closing.

func (*TSDateNanoAsyncBox) Insert added in v1.4.0

func (asyncBox *TSDateNanoAsyncBox) Insert(object *TSDateNano) (id uint64, err error)

Insert a single object asynchronously. The Id property on the passed object will be assigned the 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 (*TSDateNanoAsyncBox) Put added in v1.4.0

func (asyncBox *TSDateNanoAsyncBox) Put(object *TSDateNano) (uint64, error)

Put inserts/updates a single object asynchronously. When inserting a new object, the Id property on the passed object will be assigned the 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 (*TSDateNanoAsyncBox) Remove added in v1.4.0

func (asyncBox *TSDateNanoAsyncBox) Remove(object *TSDateNano) error

Remove deletes a single object asynchronously.

func (*TSDateNanoAsyncBox) Update added in v1.4.0

func (asyncBox *TSDateNanoAsyncBox) Update(object *TSDateNano) error

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

type TSDateNanoBox added in v1.4.0

type TSDateNanoBox struct {
	*objectbox.Box
}

Box provides CRUD access to TSDateNano objects

func BoxForTSDateNano added in v1.4.0

func BoxForTSDateNano(ob *objectbox.ObjectBox) *TSDateNanoBox

BoxForTSDateNano opens a box of TSDateNano objects

func (*TSDateNanoBox) Async added in v1.4.0

func (box *TSDateNanoBox) Async() *TSDateNanoAsyncBox

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

func (*TSDateNanoBox) Get added in v1.4.0

func (box *TSDateNanoBox) Get(id uint64) (*TSDateNano, error)

Get reads a single object.

Returns nil (and no error) in case the object with the given ID doesn't exist.

func (*TSDateNanoBox) GetAll added in v1.4.0

func (box *TSDateNanoBox) GetAll() ([]*TSDateNano, error)

GetAll reads all stored objects

func (*TSDateNanoBox) GetMany added in v1.4.0

func (box *TSDateNanoBox) GetMany(ids ...uint64) ([]*TSDateNano, error)

GetMany reads multiple objects at once. If any of the objects doesn't exist, its position in the return slice is nil

func (*TSDateNanoBox) GetManyExisting added in v1.4.0

func (box *TSDateNanoBox) GetManyExisting(ids ...uint64) ([]*TSDateNano, error)

GetManyExisting reads multiple objects at once, skipping those that do not exist.

func (*TSDateNanoBox) Insert added in v1.4.0

func (box *TSDateNanoBox) Insert(object *TSDateNano) (uint64, error)

Insert synchronously inserts a single object. As opposed to Put, Insert will fail if given an ID that already exists. In case the Id is not specified, it would be assigned automatically (auto-increment). When inserting, the TSDateNano.Id property on the passed object will be assigned the new ID as well.

func (*TSDateNanoBox) Put added in v1.4.0

func (box *TSDateNanoBox) Put(object *TSDateNano) (uint64, 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 TSDateNano.Id property on the passed object will be assigned the new ID as well.

func (*TSDateNanoBox) PutAsync added in v1.4.0

func (box *TSDateNanoBox) PutAsync(object *TSDateNano) (uint64, error)

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

func (*TSDateNanoBox) PutMany added in v1.4.0

func (box *TSDateNanoBox) PutMany(objects []*TSDateNano) ([]uint64, error)

PutMany inserts multiple objects in single transaction. 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). When inserting, the TSDateNano.Id property on the objects in the slice will be assigned the new IDs as well.

Note: In case an error occurs during the transaction, some of the objects may already have the TSDateNano.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 (*TSDateNanoBox) Query added in v1.4.0

func (box *TSDateNanoBox) Query(conditions ...objectbox.Condition) *TSDateNanoQuery

Creates a query with the given conditions. Use the fields of the TSDateNano_ struct to create conditions. Keep the *TSDateNanoQuery if you intend to execute the query 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 (*TSDateNanoBox) QueryOrError added in v1.4.0

func (box *TSDateNanoBox) QueryOrError(conditions ...objectbox.Condition) (*TSDateNanoQuery, error)

Creates a query with the given conditions. Use the fields of the TSDateNano_ struct to create conditions. Keep the *TSDateNanoQuery if you intend to execute the query multiple times.

func (*TSDateNanoBox) Remove added in v1.4.0

func (box *TSDateNanoBox) Remove(object *TSDateNano) error

Remove deletes a single object

func (*TSDateNanoBox) RemoveMany added in v1.4.0

func (box *TSDateNanoBox) RemoveMany(objects ...*TSDateNano) (uint64, error)

RemoveMany 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 (*TSDateNanoBox) Update added in v1.4.0

func (box *TSDateNanoBox) Update(object *TSDateNano) 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 TSDateNanoQuery added in v1.4.0

type TSDateNanoQuery struct {
	*objectbox.Query
}

Query provides a way to search stored objects

For example, you can find all TSDateNano which Id is either 42 or 47:

box.Query(TSDateNano_.Id.In(42, 47)).Find()

func (*TSDateNanoQuery) Find added in v1.4.0

func (query *TSDateNanoQuery) Find() ([]*TSDateNano, error)

Find returns all objects matching the query

func (*TSDateNanoQuery) Limit added in v1.4.0

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

Limit sets the number of elements to process by the query

func (*TSDateNanoQuery) Offset added in v1.4.0

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

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

type TSDateQuery added in v1.4.0

type TSDateQuery struct {
	*objectbox.Query
}

Query provides a way to search stored objects

For example, you can find all TSDate which Id is either 42 or 47:

box.Query(TSDate_.Id.In(42, 47)).Find()

func (*TSDateQuery) Find added in v1.4.0

func (query *TSDateQuery) Find() ([]*TSDate, error)

Find returns all objects matching the query

func (*TSDateQuery) Limit added in v1.4.0

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

Limit sets the number of elements to process by the query

func (*TSDateQuery) Offset added in v1.4.0

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

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

type TestEntityInline added in v0.9.0

type TestEntityInline struct {
	BaseWithDate   `objectbox:"inline"`
	*BaseWithValue `objectbox:"inline"`

	Id uint64
}

TestEntityInline model

type TestEntityInlineAsyncBox added in v1.1.0

type TestEntityInlineAsyncBox struct {
	*objectbox.AsyncBox
}

TestEntityInlineAsyncBox provides asynchronous operations on TestEntityInline objects.

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 AsyncBoxForTestEntityInline added in v1.1.0

func AsyncBoxForTestEntityInline(ob *objectbox.ObjectBox, timeoutMs uint64) *TestEntityInlineAsyncBox

AsyncBoxForTestEntityInline 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 TestEntityInlineBox::Async() which takes care of resource management and doesn't require closing.

func (*TestEntityInlineAsyncBox) Insert added in v1.1.0

func (asyncBox *TestEntityInlineAsyncBox) Insert(object *TestEntityInline) (id uint64, err error)

Insert a single object asynchronously. The Id property on the passed object will be assigned the 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 (*TestEntityInlineAsyncBox) Put added in v1.1.0

func (asyncBox *TestEntityInlineAsyncBox) Put(object *TestEntityInline) (uint64, error)

Put inserts/updates a single object asynchronously. When inserting a new object, the Id property on the passed object will be assigned the 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 (*TestEntityInlineAsyncBox) Remove added in v1.1.0

func (asyncBox *TestEntityInlineAsyncBox) Remove(object *TestEntityInline) error

Remove deletes a single object asynchronously.

func (*TestEntityInlineAsyncBox) Update added in v1.1.0

func (asyncBox *TestEntityInlineAsyncBox) Update(object *TestEntityInline) error

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

type TestEntityInlineBox added in v0.9.0

type TestEntityInlineBox struct {
	*objectbox.Box
}

Box provides CRUD access to TestEntityInline objects

func BoxForTestEntityInline added in v0.9.0

func BoxForTestEntityInline(ob *objectbox.ObjectBox) *TestEntityInlineBox

BoxForTestEntityInline opens a box of TestEntityInline objects

func (*TestEntityInlineBox) Async added in v1.1.0

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

func (*TestEntityInlineBox) Get added in v0.9.0

Get reads a single object.

Returns nil (and no error) in case the object with the given ID doesn't exist.

func (*TestEntityInlineBox) GetAll added in v0.9.0

func (box *TestEntityInlineBox) GetAll() ([]*TestEntityInline, error)

GetAll reads all stored objects

func (*TestEntityInlineBox) GetMany added in v1.0.0

func (box *TestEntityInlineBox) GetMany(ids ...uint64) ([]*TestEntityInline, error)

GetMany reads multiple objects at once. If any of the objects doesn't exist, its position in the return slice is nil

func (*TestEntityInlineBox) GetManyExisting added in v1.1.0

func (box *TestEntityInlineBox) GetManyExisting(ids ...uint64) ([]*TestEntityInline, error)

GetManyExisting reads multiple objects at once, skipping those that do not exist.

func (*TestEntityInlineBox) Insert added in v1.1.0

func (box *TestEntityInlineBox) Insert(object *TestEntityInline) (uint64, error)

Insert synchronously inserts a single object. As opposed to Put, Insert will fail if given an ID that already exists. In case the Id is not specified, it would be assigned automatically (auto-increment). When inserting, the TestEntityInline.Id property on the passed object will be assigned the new ID as well.

func (*TestEntityInlineBox) Put added in v0.9.0

func (box *TestEntityInlineBox) Put(object *TestEntityInline) (uint64, 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 TestEntityInline.Id property on the passed object will be assigned the new ID as well.

func (*TestEntityInlineBox) PutAsync added in v0.9.0

func (box *TestEntityInlineBox) PutAsync(object *TestEntityInline) (uint64, error)

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

func (*TestEntityInlineBox) PutMany added in v1.0.0

func (box *TestEntityInlineBox) PutMany(objects []*TestEntityInline) ([]uint64, error)

PutMany inserts multiple objects in single transaction. 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). When inserting, the TestEntityInline.Id property on the objects in the slice will be assigned the new IDs as well.

Note: In case an error occurs during the transaction, some of the objects may already have the TestEntityInline.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 (*TestEntityInlineBox) Query added in v0.9.0

func (box *TestEntityInlineBox) Query(conditions ...objectbox.Condition) *TestEntityInlineQuery

Creates a query with the given conditions. Use the fields of the TestEntityInline_ struct to create conditions. Keep the *TestEntityInlineQuery if you intend to execute the query 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 (*TestEntityInlineBox) QueryOrError added in v0.9.0

func (box *TestEntityInlineBox) QueryOrError(conditions ...objectbox.Condition) (*TestEntityInlineQuery, error)

Creates a query with the given conditions. Use the fields of the TestEntityInline_ struct to create conditions. Keep the *TestEntityInlineQuery if you intend to execute the query multiple times.

func (*TestEntityInlineBox) Remove added in v0.9.0

func (box *TestEntityInlineBox) Remove(object *TestEntityInline) error

Remove deletes a single object

func (*TestEntityInlineBox) RemoveMany added in v1.0.0

func (box *TestEntityInlineBox) RemoveMany(objects ...*TestEntityInline) (uint64, error)

RemoveMany 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 (*TestEntityInlineBox) Update added in v1.1.0

func (box *TestEntityInlineBox) Update(object *TestEntityInline) 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 TestEntityInlineQuery added in v0.9.0

type TestEntityInlineQuery struct {
	*objectbox.Query
}

Query provides a way to search stored objects

For example, you can find all TestEntityInline which Id is either 42 or 47:

box.Query(TestEntityInline_.Id.In(42, 47)).Find()

func (*TestEntityInlineQuery) Find added in v0.9.0

func (query *TestEntityInlineQuery) Find() ([]*TestEntityInline, error)

Find returns all objects matching the query

func (*TestEntityInlineQuery) Limit added in v0.9.0

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

Limit sets the number of elements to process by the query

func (*TestEntityInlineQuery) Offset added in v0.9.0

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

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

type TestEntityRelated added in v0.9.0

type TestEntityRelated struct {
	Id   uint64
	Name string

	// have another level of relations
	Next      *EntityByValue `objectbox:"link"`
	NextSlice []EntityByValue
}

TestEntityRelated model

type TestEntityRelatedAsyncBox added in v1.1.0

type TestEntityRelatedAsyncBox struct {
	*objectbox.AsyncBox
}

TestEntityRelatedAsyncBox provides asynchronous operations on TestEntityRelated objects.

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 AsyncBoxForTestEntityRelated added in v1.1.0

func AsyncBoxForTestEntityRelated(ob *objectbox.ObjectBox, timeoutMs uint64) *TestEntityRelatedAsyncBox

AsyncBoxForTestEntityRelated 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 TestEntityRelatedBox::Async() which takes care of resource management and doesn't require closing.

func (*TestEntityRelatedAsyncBox) Insert added in v1.1.0

func (asyncBox *TestEntityRelatedAsyncBox) Insert(object *TestEntityRelated) (id uint64, err error)

Insert a single object asynchronously. The Id property on the passed object will be assigned the 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 (*TestEntityRelatedAsyncBox) Put added in v1.1.0

func (asyncBox *TestEntityRelatedAsyncBox) Put(object *TestEntityRelated) (uint64, error)

Put inserts/updates a single object asynchronously. When inserting a new object, the Id property on the passed object will be assigned the 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 (*TestEntityRelatedAsyncBox) Remove added in v1.1.0

func (asyncBox *TestEntityRelatedAsyncBox) Remove(object *TestEntityRelated) error

Remove deletes a single object asynchronously.

func (*TestEntityRelatedAsyncBox) Update added in v1.1.0

func (asyncBox *TestEntityRelatedAsyncBox) Update(object *TestEntityRelated) error

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

type TestEntityRelatedBox added in v0.9.0

type TestEntityRelatedBox struct {
	*objectbox.Box
}

Box provides CRUD access to TestEntityRelated objects

func BoxForTestEntityRelated added in v0.9.0

func BoxForTestEntityRelated(ob *objectbox.ObjectBox) *TestEntityRelatedBox

BoxForTestEntityRelated opens a box of TestEntityRelated objects

func (*TestEntityRelatedBox) Async added in v1.1.0

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

func (*TestEntityRelatedBox) Get added in v0.9.0

Get reads a single object.

Returns nil (and no error) in case the object with the given ID doesn't exist.

func (*TestEntityRelatedBox) GetAll added in v0.9.0

func (box *TestEntityRelatedBox) GetAll() ([]*TestEntityRelated, error)

GetAll reads all stored objects

func (*TestEntityRelatedBox) GetMany added in v1.0.0

func (box *TestEntityRelatedBox) GetMany(ids ...uint64) ([]*TestEntityRelated, error)

GetMany reads multiple objects at once. If any of the objects doesn't exist, its position in the return slice is nil

func (*TestEntityRelatedBox) GetManyExisting added in v1.1.0

func (box *TestEntityRelatedBox) GetManyExisting(ids ...uint64) ([]*TestEntityRelated, error)

GetManyExisting reads multiple objects at once, skipping those that do not exist.

func (*TestEntityRelatedBox) Insert added in v1.1.0

func (box *TestEntityRelatedBox) Insert(object *TestEntityRelated) (uint64, error)

Insert synchronously inserts a single object. As opposed to Put, Insert will fail if given an ID that already exists. In case the Id is not specified, it would be assigned automatically (auto-increment). When inserting, the TestEntityRelated.Id property on the passed object will be assigned the new ID as well.

func (*TestEntityRelatedBox) Put added in v0.9.0

func (box *TestEntityRelatedBox) Put(object *TestEntityRelated) (uint64, 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 TestEntityRelated.Id property on the passed object will be assigned the new ID as well.

func (*TestEntityRelatedBox) PutAsync added in v0.9.0

func (box *TestEntityRelatedBox) PutAsync(object *TestEntityRelated) (uint64, error)

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

func (*TestEntityRelatedBox) PutMany added in v1.0.0

func (box *TestEntityRelatedBox) PutMany(objects []*TestEntityRelated) ([]uint64, error)

PutMany inserts multiple objects in single transaction. 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). When inserting, the TestEntityRelated.Id property on the objects in the slice will be assigned the new IDs as well.

Note: In case an error occurs during the transaction, some of the objects may already have the TestEntityRelated.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 (*TestEntityRelatedBox) Query added in v0.9.0

Creates a query with the given conditions. Use the fields of the TestEntityRelated_ struct to create conditions. Keep the *TestEntityRelatedQuery if you intend to execute the query 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 (*TestEntityRelatedBox) QueryOrError added in v0.9.0

func (box *TestEntityRelatedBox) QueryOrError(conditions ...objectbox.Condition) (*TestEntityRelatedQuery, error)

Creates a query with the given conditions. Use the fields of the TestEntityRelated_ struct to create conditions. Keep the *TestEntityRelatedQuery if you intend to execute the query multiple times.

func (*TestEntityRelatedBox) Remove added in v0.9.0

func (box *TestEntityRelatedBox) Remove(object *TestEntityRelated) error

Remove deletes a single object

func (*TestEntityRelatedBox) RemoveMany added in v1.0.0

func (box *TestEntityRelatedBox) RemoveMany(objects ...*TestEntityRelated) (uint64, error)

RemoveMany 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 (*TestEntityRelatedBox) Update added in v1.1.0

func (box *TestEntityRelatedBox) Update(object *TestEntityRelated) 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 TestEntityRelatedQuery added in v0.9.0

type TestEntityRelatedQuery struct {
	*objectbox.Query
}

Query provides a way to search stored objects

For example, you can find all TestEntityRelated which Id is either 42 or 47:

box.Query(TestEntityRelated_.Id.In(42, 47)).Find()

func (*TestEntityRelatedQuery) Find added in v0.9.0

func (query *TestEntityRelatedQuery) Find() ([]*TestEntityRelated, error)

Find returns all objects matching the query

func (*TestEntityRelatedQuery) Limit added in v0.9.0

Limit sets the number of elements to process by the query

func (*TestEntityRelatedQuery) Offset added in v0.9.0

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

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

type TestEntitySynced added in v1.5.0

type TestEntitySynced struct {
	Id   uint64
	Name string
}

TestEntitySynced model `objectbox:"sync"`

type TestEntitySyncedAsyncBox added in v1.5.0

type TestEntitySyncedAsyncBox struct {
	*objectbox.AsyncBox
}

TestEntitySyncedAsyncBox provides asynchronous operations on TestEntitySynced objects.

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 AsyncBoxForTestEntitySynced added in v1.5.0

func AsyncBoxForTestEntitySynced(ob *objectbox.ObjectBox, timeoutMs uint64) *TestEntitySyncedAsyncBox

AsyncBoxForTestEntitySynced 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 TestEntitySyncedBox::Async() which takes care of resource management and doesn't require closing.

func (*TestEntitySyncedAsyncBox) Insert added in v1.5.0

func (asyncBox *TestEntitySyncedAsyncBox) Insert(object *TestEntitySynced) (id uint64, err error)

Insert a single object asynchronously. The Id property on the passed object will be assigned the 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 (*TestEntitySyncedAsyncBox) Put added in v1.5.0

func (asyncBox *TestEntitySyncedAsyncBox) Put(object *TestEntitySynced) (uint64, error)

Put inserts/updates a single object asynchronously. When inserting a new object, the Id property on the passed object will be assigned the 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 (*TestEntitySyncedAsyncBox) Remove added in v1.5.0

func (asyncBox *TestEntitySyncedAsyncBox) Remove(object *TestEntitySynced) error

Remove deletes a single object asynchronously.

func (*TestEntitySyncedAsyncBox) Update added in v1.5.0

func (asyncBox *TestEntitySyncedAsyncBox) Update(object *TestEntitySynced) error

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

type TestEntitySyncedBox added in v1.5.0

type TestEntitySyncedBox struct {
	*objectbox.Box
}

Box provides CRUD access to TestEntitySynced objects

func BoxForTestEntitySynced added in v1.5.0

func BoxForTestEntitySynced(ob *objectbox.ObjectBox) *TestEntitySyncedBox

BoxForTestEntitySynced opens a box of TestEntitySynced objects

func (*TestEntitySyncedBox) Async added in v1.5.0

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

func (*TestEntitySyncedBox) Get added in v1.5.0

Get reads a single object.

Returns nil (and no error) in case the object with the given ID doesn't exist.

func (*TestEntitySyncedBox) GetAll added in v1.5.0

func (box *TestEntitySyncedBox) GetAll() ([]*TestEntitySynced, error)

GetAll reads all stored objects

func (*TestEntitySyncedBox) GetMany added in v1.5.0

func (box *TestEntitySyncedBox) GetMany(ids ...uint64) ([]*TestEntitySynced, error)

GetMany reads multiple objects at once. If any of the objects doesn't exist, its position in the return slice is nil

func (*TestEntitySyncedBox) GetManyExisting added in v1.5.0

func (box *TestEntitySyncedBox) GetManyExisting(ids ...uint64) ([]*TestEntitySynced, error)

GetManyExisting reads multiple objects at once, skipping those that do not exist.

func (*TestEntitySyncedBox) Insert added in v1.5.0

func (box *TestEntitySyncedBox) Insert(object *TestEntitySynced) (uint64, error)

Insert synchronously inserts a single object. As opposed to Put, Insert will fail if given an ID that already exists. In case the Id is not specified, it would be assigned automatically (auto-increment). When inserting, the TestEntitySynced.Id property on the passed object will be assigned the new ID as well.

func (*TestEntitySyncedBox) Put added in v1.5.0

func (box *TestEntitySyncedBox) Put(object *TestEntitySynced) (uint64, 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 TestEntitySynced.Id property on the passed object will be assigned the new ID as well.

func (*TestEntitySyncedBox) PutAsync added in v1.5.0

func (box *TestEntitySyncedBox) PutAsync(object *TestEntitySynced) (uint64, error)

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

func (*TestEntitySyncedBox) PutMany added in v1.5.0

func (box *TestEntitySyncedBox) PutMany(objects []*TestEntitySynced) ([]uint64, error)

PutMany inserts multiple objects in single transaction. 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). When inserting, the TestEntitySynced.Id property on the objects in the slice will be assigned the new IDs as well.

Note: In case an error occurs during the transaction, some of the objects may already have the TestEntitySynced.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 (*TestEntitySyncedBox) Query added in v1.5.0

func (box *TestEntitySyncedBox) Query(conditions ...objectbox.Condition) *TestEntitySyncedQuery

Creates a query with the given conditions. Use the fields of the TestEntitySynced_ struct to create conditions. Keep the *TestEntitySyncedQuery if you intend to execute the query 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 (*TestEntitySyncedBox) QueryOrError added in v1.5.0

func (box *TestEntitySyncedBox) QueryOrError(conditions ...objectbox.Condition) (*TestEntitySyncedQuery, error)

Creates a query with the given conditions. Use the fields of the TestEntitySynced_ struct to create conditions. Keep the *TestEntitySyncedQuery if you intend to execute the query multiple times.

func (*TestEntitySyncedBox) Remove added in v1.5.0

func (box *TestEntitySyncedBox) Remove(object *TestEntitySynced) error

Remove deletes a single object

func (*TestEntitySyncedBox) RemoveMany added in v1.5.0

func (box *TestEntitySyncedBox) RemoveMany(objects ...*TestEntitySynced) (uint64, error)

RemoveMany 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 (*TestEntitySyncedBox) Update added in v1.5.0

func (box *TestEntitySyncedBox) Update(object *TestEntitySynced) 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 TestEntitySyncedQuery added in v1.5.0

type TestEntitySyncedQuery struct {
	*objectbox.Query
}

Query provides a way to search stored objects

For example, you can find all TestEntitySynced which Id is either 42 or 47:

box.Query(TestEntitySynced_.Id.In(42, 47)).Find()

func (*TestEntitySyncedQuery) Find added in v1.5.0

func (query *TestEntitySyncedQuery) Find() ([]*TestEntitySynced, error)

Find returns all objects matching the query

func (*TestEntitySyncedQuery) Limit added in v1.5.0

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

Limit sets the number of elements to process by the query

func (*TestEntitySyncedQuery) Offset added in v1.5.0

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

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

type TestEnv

type TestEnv struct {
	ObjectBox *objectbox.ObjectBox
	Box       *EntityBox
	Directory string
	// contains filtered or unexported fields
}

TestEnv provides environment for testing ObjectBox. It sets up the database and populates it with data.

func NewTestEnv

func NewTestEnv(t *testing.T) *TestEnv

NewTestEnv creates the test environment

func (*TestEnv) Close

func (env *TestEnv) Close()

Close closes ObjectBox and removes the database

func (*TestEnv) Populate

func (env *TestEnv) Populate(count uint)

Populate creates given number of entities in the database

func (*TestEnv) PutEntity

func (env *TestEnv) PutEntity(entity *Entity) uint64

PutEntity creates an entity

func (*TestEnv) SetOptions added in v0.9.0

func (env *TestEnv) SetOptions(options TestEnvOptions) *TestEnv

SetOptions configures options

func (*TestEnv) SyncClient added in v1.3.0

func (env *TestEnv) SyncClient(serverUri string) *objectbox.SyncClient

type TestEnvOptions added in v0.9.0

type TestEnvOptions struct {
	PopulateRelations bool
}

TestEnvOptions configure the TestEnv

type TestStringIdEntity added in v0.9.0

type TestStringIdEntity struct {
	Id string `objectbox:"id(assignable)"` // id(assignable) also works with integer IDs, but let's test this "harder" case
}

TestStringIdEntity model

type TestStringIdEntityAsyncBox added in v1.1.0

type TestStringIdEntityAsyncBox struct {
	*objectbox.AsyncBox
}

TestStringIdEntityAsyncBox provides asynchronous operations on TestStringIdEntity objects.

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 AsyncBoxForTestStringIdEntity added in v1.1.0

func AsyncBoxForTestStringIdEntity(ob *objectbox.ObjectBox, timeoutMs uint64) *TestStringIdEntityAsyncBox

AsyncBoxForTestStringIdEntity 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 TestStringIdEntityBox::Async() which takes care of resource management and doesn't require closing.

func (*TestStringIdEntityAsyncBox) Insert added in v1.1.0

func (asyncBox *TestStringIdEntityAsyncBox) Insert(object *TestStringIdEntity) (id uint64, err error)

Insert a single object asynchronously. The Id property on the passed object will be assigned the 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 (*TestStringIdEntityAsyncBox) Put added in v1.1.0

func (asyncBox *TestStringIdEntityAsyncBox) Put(object *TestStringIdEntity) (uint64, error)

Put inserts/updates a single object asynchronously. When inserting a new object, the Id property on the passed object will be assigned the 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 (*TestStringIdEntityAsyncBox) Remove added in v1.1.0

func (asyncBox *TestStringIdEntityAsyncBox) Remove(object *TestStringIdEntity) error

Remove deletes a single object asynchronously.

func (*TestStringIdEntityAsyncBox) Update added in v1.1.0

func (asyncBox *TestStringIdEntityAsyncBox) Update(object *TestStringIdEntity) error

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

type TestStringIdEntityBox added in v0.9.0

type TestStringIdEntityBox struct {
	*objectbox.Box
}

Box provides CRUD access to TestStringIdEntity objects

func BoxForTestStringIdEntity added in v0.9.0

func BoxForTestStringIdEntity(ob *objectbox.ObjectBox) *TestStringIdEntityBox

BoxForTestStringIdEntity opens a box of TestStringIdEntity objects

func (*TestStringIdEntityBox) Async added in v1.1.0

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

func (*TestStringIdEntityBox) Get added in v0.9.0

Get reads a single object.

Returns nil (and no error) in case the object with the given ID doesn't exist.

func (*TestStringIdEntityBox) GetAll added in v0.9.0

func (box *TestStringIdEntityBox) GetAll() ([]*TestStringIdEntity, error)

GetAll reads all stored objects

func (*TestStringIdEntityBox) GetMany added in v1.0.0

func (box *TestStringIdEntityBox) GetMany(ids ...uint64) ([]*TestStringIdEntity, error)

GetMany reads multiple objects at once. If any of the objects doesn't exist, its position in the return slice is nil

func (*TestStringIdEntityBox) GetManyExisting added in v1.1.0

func (box *TestStringIdEntityBox) GetManyExisting(ids ...uint64) ([]*TestStringIdEntity, error)

GetManyExisting reads multiple objects at once, skipping those that do not exist.

func (*TestStringIdEntityBox) Insert added in v1.1.0

func (box *TestStringIdEntityBox) Insert(object *TestStringIdEntity) (uint64, error)

Insert synchronously inserts a single object. As opposed to Put, Insert will fail if given an ID that already exists. In case the Id is not specified, it would be assigned automatically (auto-increment). When inserting, the TestStringIdEntity.Id property on the passed object will be assigned the new ID as well.

func (*TestStringIdEntityBox) Put added in v0.9.0

Put synchronously inserts/updates a single object. In case the Id is not specified, it would be assigned automatically (auto-increment). When inserting, the TestStringIdEntity.Id property on the passed object will be assigned the new ID as well.

func (*TestStringIdEntityBox) PutAsync added in v0.9.0

func (box *TestStringIdEntityBox) PutAsync(object *TestStringIdEntity) (uint64, error)

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

func (*TestStringIdEntityBox) PutMany added in v1.0.0

func (box *TestStringIdEntityBox) PutMany(objects []*TestStringIdEntity) ([]uint64, error)

PutMany inserts multiple objects in single transaction. 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). When inserting, the TestStringIdEntity.Id property on the objects in the slice will be assigned the new IDs as well.

Note: In case an error occurs during the transaction, some of the objects may already have the TestStringIdEntity.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 (*TestStringIdEntityBox) Query added in v0.9.0

Creates a query with the given conditions. Use the fields of the TestStringIdEntity_ struct to create conditions. Keep the *TestStringIdEntityQuery if you intend to execute the query 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 (*TestStringIdEntityBox) QueryOrError added in v0.9.0

func (box *TestStringIdEntityBox) QueryOrError(conditions ...objectbox.Condition) (*TestStringIdEntityQuery, error)

Creates a query with the given conditions. Use the fields of the TestStringIdEntity_ struct to create conditions. Keep the *TestStringIdEntityQuery if you intend to execute the query multiple times.

func (*TestStringIdEntityBox) Remove added in v0.9.0

func (box *TestStringIdEntityBox) Remove(object *TestStringIdEntity) error

Remove deletes a single object

func (*TestStringIdEntityBox) RemoveMany added in v1.0.0

func (box *TestStringIdEntityBox) RemoveMany(objects ...*TestStringIdEntity) (uint64, error)

RemoveMany 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 (*TestStringIdEntityBox) Update added in v1.1.0

func (box *TestStringIdEntityBox) Update(object *TestStringIdEntity) 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 TestStringIdEntityQuery added in v0.9.0

type TestStringIdEntityQuery struct {
	*objectbox.Query
}

Query provides a way to search stored objects

For example, you can find all TestStringIdEntity which Id is either 42 or 47:

box.Query(TestStringIdEntity_.Id.In(42, 47)).Find()

func (*TestStringIdEntityQuery) Find added in v0.9.0

func (query *TestStringIdEntityQuery) Find() ([]*TestStringIdEntity, error)

Find returns all objects matching the query

func (*TestStringIdEntityQuery) Limit added in v0.9.0

Limit sets the number of elements to process by the query

func (*TestStringIdEntityQuery) Offset added in v0.9.0

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL