model

package
v0.9.0-rc Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2019 License: Apache-2.0 Imports: 12 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
	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
	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,
	},
	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.

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 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 `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  `date type:"int64" converter:"timeInt64"`
	Complex128 complex128 `type:"[]byte" converter:"complex128Bytes"`

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

	// many-to-many relations
	RelatedSlice    []EntityByValue
	RelatedPtrSlice []*TestEntityRelated
}

Tests all available GO & ObjectBox types TODO rename; e.g. TestEntity

func Entity47

func Entity47() *Entity

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

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

Get reads all stored objects

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

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

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

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

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

Remove deletes a single object

type EntityByValue added in v0.9.0

type EntityByValue struct {
	Id   uint64
	Text string
}

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

Get reads all stored objects

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) PutAll added in v0.9.0

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

PutAll 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) 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) 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) (err error)

Remove deletes a single object

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 TestEntityInline added in v0.9.0

type TestEntityInline struct {
	BaseWithDate   `inline`
	*BaseWithValue `inline`

	Id uint64
}

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

Get reads all stored objects

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) PutAll added in v0.9.0

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

PutAll 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) 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) 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) (err error)

Remove deletes a single object

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 `link`
	NextSlice []EntityByValue
}

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

Get reads all stored objects

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) PutAll added in v0.9.0

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

PutAll 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) 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) 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) (err error)

Remove deletes a single object

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 TestEnv

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

func NewTestEnv

func NewTestEnv(t *testing.T) *TestEnv

func (*TestEnv) Close

func (env *TestEnv) Close()

func (*TestEnv) Populate

func (env *TestEnv) Populate(count uint)

func (*TestEnv) PutEntity

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

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 `id`
}

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

Get reads all stored objects

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) PutAll added in v0.9.0

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

PutAll 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) 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) 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) (err error)

Remove deletes a single object

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