Documentation
¶
Index ¶
- Variables
- func ObjectBoxModel() *objectbox.Model
- type BaseWithDate
- type BaseWithValue
- type Entity
- type EntityBox
- func (box *EntityBox) FetchRelatedPtrSlice(sourceObjects ...*Entity) error
- func (box *EntityBox) Get(id uint64) (*Entity, error)
- func (box *EntityBox) GetAll() ([]*Entity, error)
- func (box *EntityBox) GetMany(ids ...uint64) ([]*Entity, error)
- func (box *EntityBox) Put(object *Entity) (uint64, error)
- func (box *EntityBox) PutAsync(object *Entity) (uint64, error)
- func (box *EntityBox) PutMany(objects []*Entity) ([]uint64, error)
- func (box *EntityBox) Query(conditions ...objectbox.Condition) *EntityQuery
- func (box *EntityBox) QueryOrError(conditions ...objectbox.Condition) (*EntityQuery, error)
- func (box *EntityBox) Remove(object *Entity) error
- func (box *EntityBox) RemoveMany(objects ...*Entity) (uint64, error)
- type EntityByValue
- type EntityByValueBox
- func (box *EntityByValueBox) Get(id uint64) (*EntityByValue, error)
- func (box *EntityByValueBox) GetAll() ([]EntityByValue, error)
- func (box *EntityByValueBox) GetMany(ids ...uint64) ([]EntityByValue, error)
- func (box *EntityByValueBox) Put(object *EntityByValue) (uint64, error)
- func (box *EntityByValueBox) PutAsync(object *EntityByValue) (uint64, error)
- func (box *EntityByValueBox) PutMany(objects []EntityByValue) ([]uint64, error)
- func (box *EntityByValueBox) Query(conditions ...objectbox.Condition) *EntityByValueQuery
- func (box *EntityByValueBox) QueryOrError(conditions ...objectbox.Condition) (*EntityByValueQuery, error)
- func (box *EntityByValueBox) Remove(object *EntityByValue) error
- func (box *EntityByValueBox) RemoveMany(objects ...*EntityByValue) (uint64, error)
- type EntityByValueQuery
- type EntityQuery
- type TestEntityInline
- type TestEntityInlineBox
- func (box *TestEntityInlineBox) Get(id uint64) (*TestEntityInline, error)
- func (box *TestEntityInlineBox) GetAll() ([]*TestEntityInline, error)
- func (box *TestEntityInlineBox) GetMany(ids ...uint64) ([]*TestEntityInline, error)
- func (box *TestEntityInlineBox) Put(object *TestEntityInline) (uint64, error)
- func (box *TestEntityInlineBox) PutAsync(object *TestEntityInline) (uint64, error)
- func (box *TestEntityInlineBox) PutMany(objects []*TestEntityInline) ([]uint64, error)
- func (box *TestEntityInlineBox) Query(conditions ...objectbox.Condition) *TestEntityInlineQuery
- func (box *TestEntityInlineBox) QueryOrError(conditions ...objectbox.Condition) (*TestEntityInlineQuery, error)
- func (box *TestEntityInlineBox) Remove(object *TestEntityInline) error
- func (box *TestEntityInlineBox) RemoveMany(objects ...*TestEntityInline) (uint64, error)
- type TestEntityInlineQuery
- type TestEntityRelated
- type TestEntityRelatedBox
- func (box *TestEntityRelatedBox) Get(id uint64) (*TestEntityRelated, error)
- func (box *TestEntityRelatedBox) GetAll() ([]*TestEntityRelated, error)
- func (box *TestEntityRelatedBox) GetMany(ids ...uint64) ([]*TestEntityRelated, error)
- func (box *TestEntityRelatedBox) Put(object *TestEntityRelated) (uint64, error)
- func (box *TestEntityRelatedBox) PutAsync(object *TestEntityRelated) (uint64, error)
- func (box *TestEntityRelatedBox) PutMany(objects []*TestEntityRelated) ([]uint64, error)
- func (box *TestEntityRelatedBox) Query(conditions ...objectbox.Condition) *TestEntityRelatedQuery
- func (box *TestEntityRelatedBox) QueryOrError(conditions ...objectbox.Condition) (*TestEntityRelatedQuery, error)
- func (box *TestEntityRelatedBox) Remove(object *TestEntityRelated) error
- func (box *TestEntityRelatedBox) RemoveMany(objects ...*TestEntityRelated) (uint64, error)
- type TestEntityRelatedQuery
- type TestEnv
- type TestEnvOptions
- type TestStringIdEntity
- type TestStringIdEntityBox
- func (box *TestStringIdEntityBox) Get(id uint64) (*TestStringIdEntity, error)
- func (box *TestStringIdEntityBox) GetAll() ([]*TestStringIdEntity, error)
- func (box *TestStringIdEntityBox) GetMany(ids ...uint64) ([]*TestStringIdEntity, error)
- func (box *TestStringIdEntityBox) Put(object *TestStringIdEntity) (uint64, error)
- func (box *TestStringIdEntityBox) PutAsync(object *TestStringIdEntity) (uint64, error)
- func (box *TestStringIdEntityBox) PutMany(objects []*TestStringIdEntity) ([]uint64, error)
- func (box *TestStringIdEntityBox) Query(conditions ...objectbox.Condition) *TestStringIdEntityQuery
- func (box *TestStringIdEntityBox) QueryOrError(conditions ...objectbox.Condition) (*TestStringIdEntityQuery, error)
- func (box *TestStringIdEntityBox) Remove(object *TestStringIdEntity) error
- func (box *TestStringIdEntityBox) RemoveMany(objects ...*TestStringIdEntity) (uint64, error)
- type TestStringIdEntityQuery
Constants ¶
This section is empty.
Variables ¶
var EntityBinding = entity_EntityInfo{ Entity: objectbox.Entity{ Id: 1, }, Uid: 3022148985475790732, }
var EntityByValueBinding = entityByValue_EntityInfo{ Entity: objectbox.Entity{ Id: 3, }, Uid: 2793387980842421409, }
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.
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 StringVector *objectbox.PropertyStringVector Byte *objectbox.PropertyByte ByteVector *objectbox.PropertyByteVector Rune *objectbox.PropertyRune Float32 *objectbox.PropertyFloat32 Float64 *objectbox.PropertyFloat64 Date *objectbox.PropertyInt64 Complex128 *objectbox.PropertyByteVector 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 StringVectorPtr *objectbox.PropertyStringVector BytePtr *objectbox.PropertyByte ByteVectorPtr *objectbox.PropertyByteVector RunePtr *objectbox.PropertyRune Float32Ptr *objectbox.PropertyFloat32 Float64Ptr *objectbox.PropertyFloat64 RelatedPtrSlice *objectbox.RelationToMany RelatedSlice *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, }, }, StringVector: &objectbox.PropertyStringVector{ BaseProperty: &objectbox.BaseProperty{ Id: 21, 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, }, }, 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, }, }, StringVectorPtr: &objectbox.PropertyStringVector{ BaseProperty: &objectbox.BaseProperty{ Id: 43, Entity: &EntityBinding.Entity, }, }, BytePtr: &objectbox.PropertyByte{ BaseProperty: &objectbox.BaseProperty{ Id: 38, Entity: &EntityBinding.Entity, }, }, ByteVectorPtr: &objectbox.PropertyByteVector{ BaseProperty: &objectbox.BaseProperty{ Id: 44, 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, }, }, RelatedPtrSlice: &objectbox.RelationToMany{ Id: 5, Source: &EntityBinding.Entity, Target: &TestEntityRelatedBinding.Entity, }, RelatedSlice: &objectbox.RelationToMany{ Id: 4, Source: &EntityBinding.Entity, Target: &EntityByValueBinding.Entity, }, }
Entity_ contains type-based Property helpers to facilitate some common operations such as Queries.
var TestEntityInlineBinding = testEntityInline_EntityInfo{ Entity: objectbox.Entity{ Id: 4, }, Uid: 7566870022778519807, }
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.
var TestEntityRelatedBinding = testEntityRelated_EntityInfo{ Entity: objectbox.Entity{ Id: 5, }, Uid: 145948658381494339, }
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.
var TestStringIdEntityBinding = testStringIdEntity_EntityInfo{ Entity: objectbox.Entity{ Id: 2, }, Uid: 5412225159475839048, }
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 ¶
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"`
}
type BaseWithValue ¶ added in v0.9.0
type BaseWithValue struct {
Value float64
}
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 type:int64 converter:timeInt64"`
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
}
Tests all available GO & ObjectBox types TODO rename; e.g. TestEntity
type EntityBox ¶
Box provides CRUD access to Entity objects
func BoxForEntity ¶
BoxForEntity opens a box of Entity objects
func (*EntityBox) FetchRelatedPtrSlice ¶ added in v1.0.0
FetchRelatedPtrSlice reads target objects for relation Entity::RelatedPtrSlice. It will "GetMany()" 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 ¶
Get reads a single object.
Returns nil (and no error) in case the object with the given ID doesn't exist.
func (*EntityBox) GetMany ¶ added in v1.0.0
GetMany reads multiple objects at once. If any of the objects doesn't exist, its position in the return slice is nil
func (*EntityBox) Put ¶
Put synchronously inserts/updates a single object. In case the Id is not specified, it would be assigned automatically (auto-increment). When inserting, the Entity.Id property on the passed object will be assigned the new ID as well.
func (*EntityBox) PutAsync ¶
PutAsync asynchronously inserts/updates a single object. When inserting, the Entity.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 (<1s). In the unlikely event that the object could not be enqueued after delaying, 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 (typically 3 ms) in which the data may not have been committed durably yet.
func (*EntityBox) PutMany ¶ added in v1.0.0
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) RemoveMany ¶ added in v1.0.0
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.
type EntityByValue ¶ added in v0.9.0
type EntityByValueBox ¶ added in v0.9.0
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) 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) 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. When inserting, the EntityByValue.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 (<1s). In the unlikely event that the object could not be enqueued after delaying, 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 (typically 3 ms) in which the data may not have been committed durably yet.
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.
type EntityByValueQuery ¶ added in v0.9.0
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 ¶
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 TestEntityInline ¶ added in v0.9.0
type TestEntityInline struct {
BaseWithDate `objectbox:"inline"`
*BaseWithValue `objectbox:"inline"`
Id uint64
}
type TestEntityInlineBox ¶ added in v0.9.0
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) Get ¶ added in v0.9.0
func (box *TestEntityInlineBox) Get(id uint64) (*TestEntityInline, error)
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) 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. When inserting, the TestEntityInline.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 (<1s). In the unlikely event that the object could not be enqueued after delaying, 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 (typically 3 ms) in which the data may not have been committed durably yet.
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.
type TestEntityInlineQuery ¶ added in v0.9.0
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
}
type TestEntityRelatedBox ¶ added in v0.9.0
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) Get ¶ added in v0.9.0
func (box *TestEntityRelatedBox) Get(id uint64) (*TestEntityRelated, error)
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) 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. When inserting, the TestEntityRelated.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 (<1s). In the unlikely event that the object could not be enqueued after delaying, 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 (typically 3 ms) in which the data may not have been committed durably yet.
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
func (box *TestEntityRelatedBox) Query(conditions ...objectbox.Condition) *TestEntityRelatedQuery
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.
type TestEntityRelatedQuery ¶ added in v0.9.0
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
func (query *TestEntityRelatedQuery) Limit(limit uint64) *TestEntityRelatedQuery
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 TestEnv ¶
type TestEnv struct {
ObjectBox *objectbox.ObjectBox
Box *EntityBox
// contains filtered or unexported fields
}
func NewTestEnv ¶
func (*TestEnv) SetOptions ¶ added in v0.9.0
func (env *TestEnv) SetOptions(options TestEnvOptions) *TestEnv
type TestEnvOptions ¶ added in v0.9.0
type TestEnvOptions struct {
PopulateRelations bool
}
type TestStringIdEntity ¶ added in v0.9.0
type TestStringIdEntity struct {
Id string `objectbox:"id"`
}
type TestStringIdEntityBox ¶ added in v0.9.0
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) Get ¶ added in v0.9.0
func (box *TestStringIdEntityBox) Get(id uint64) (*TestStringIdEntity, error)
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) Put ¶ added in v0.9.0
func (box *TestStringIdEntityBox) Put(object *TestStringIdEntity) (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 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. When inserting, the TestStringIdEntity.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 (<1s). In the unlikely event that the object could not be enqueued after delaying, 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 (typically 3 ms) in which the data may not have been committed durably yet.
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
func (box *TestStringIdEntityBox) Query(conditions ...objectbox.Condition) *TestStringIdEntityQuery
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.
type TestStringIdEntityQuery ¶ added in v0.9.0
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
func (query *TestStringIdEntityQuery) Limit(limit uint64) *TestStringIdEntityQuery
Limit sets the number of elements to process by the query
func (*TestStringIdEntityQuery) Offset ¶ added in v0.9.0
func (query *TestStringIdEntityQuery) Offset(offset uint64) *TestStringIdEntityQuery
Offset defines the index of the first object to process (how many objects to skip)