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

package model

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

Index

Package Files

byvalue.go byvalue.obx.go entity.go entity.obx.go objectbox-model.go testenv.go types.go

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.

func ObjectBoxModel Uses

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.

type BaseWithDate Uses

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

type BaseWithValue Uses

type BaseWithValue struct {
    Value float64
}

type Entity Uses

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

func Entity47 Uses

func Entity47() *Entity

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

type EntityBox Uses

type EntityBox struct {
    *objectbox.Box
}

Box provides CRUD access to Entity objects

func BoxForEntity Uses

func BoxForEntity(ob *objectbox.ObjectBox) *EntityBox

BoxForEntity opens a box of Entity objects

func (*EntityBox) FetchRelatedPtrSlice Uses

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

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 Uses

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 Uses

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

GetAll reads all stored objects

func (*EntityBox) GetMany Uses

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

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 Uses

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

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 Uses

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 Uses

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 Uses

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

Remove deletes a single object

func (*EntityBox) RemoveMany Uses

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.

type EntityByValue Uses

type EntityByValue struct {
    Id   uint64
    Text string
}

type EntityByValueBox Uses

type EntityByValueBox struct {
    *objectbox.Box
}

Box provides CRUD access to EntityByValue objects

func BoxForEntityByValue Uses

func BoxForEntityByValue(ob *objectbox.ObjectBox) *EntityByValueBox

BoxForEntityByValue opens a box of EntityByValue objects

func (*EntityByValueBox) Get Uses

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 Uses

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

GetAll reads all stored objects

func (*EntityByValueBox) GetMany Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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

Remove deletes a single object

func (*EntityByValueBox) RemoveMany Uses

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 Uses

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 Uses

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

Find returns all objects matching the query

func (*EntityByValueQuery) Limit Uses

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

Limit sets the number of elements to process by the query

func (*EntityByValueQuery) Offset Uses

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

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

type EntityQuery Uses

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 Uses

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

Find returns all objects matching the query

func (*EntityQuery) Limit Uses

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

Limit sets the number of elements to process by the query

func (*EntityQuery) Offset Uses

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

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

type TestEntityInline Uses

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

    Id  uint64
}

type TestEntityInlineBox Uses

type TestEntityInlineBox struct {
    *objectbox.Box
}

Box provides CRUD access to TestEntityInline objects

func BoxForTestEntityInline Uses

func BoxForTestEntityInline(ob *objectbox.ObjectBox) *TestEntityInlineBox

BoxForTestEntityInline opens a box of TestEntityInline objects

func (*TestEntityInlineBox) Get Uses

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 Uses

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

GetAll reads all stored objects

func (*TestEntityInlineBox) GetMany Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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

Remove deletes a single object

func (*TestEntityInlineBox) RemoveMany Uses

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 Uses

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 Uses

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

Find returns all objects matching the query

func (*TestEntityInlineQuery) Limit Uses

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

Limit sets the number of elements to process by the query

func (*TestEntityInlineQuery) Offset Uses

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

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

type TestEntityRelated Uses

type TestEntityRelated struct {
    Id   uint64
    Name string

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

type TestEntityRelatedBox Uses

type TestEntityRelatedBox struct {
    *objectbox.Box
}

Box provides CRUD access to TestEntityRelated objects

func BoxForTestEntityRelated Uses

func BoxForTestEntityRelated(ob *objectbox.ObjectBox) *TestEntityRelatedBox

BoxForTestEntityRelated opens a box of TestEntityRelated objects

func (*TestEntityRelatedBox) Get Uses

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 Uses

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

GetAll reads all stored objects

func (*TestEntityRelatedBox) GetMany Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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

Remove deletes a single object

func (*TestEntityRelatedBox) RemoveMany Uses

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 Uses

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 Uses

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

Find returns all objects matching the query

func (*TestEntityRelatedQuery) Limit Uses

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

Limit sets the number of elements to process by the query

func (*TestEntityRelatedQuery) Offset Uses

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

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

type TestEnv Uses

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

func NewTestEnv Uses

func NewTestEnv(t *testing.T) *TestEnv

func (*TestEnv) Close Uses

func (env *TestEnv) Close()

func (*TestEnv) Populate Uses

func (env *TestEnv) Populate(count uint)

func (*TestEnv) PutEntity Uses

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

func (*TestEnv) SetOptions Uses

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

type TestEnvOptions Uses

type TestEnvOptions struct {
    PopulateRelations bool
}

type TestStringIdEntity Uses

type TestStringIdEntity struct {
    Id string `objectbox:"id"`
}

type TestStringIdEntityBox Uses

type TestStringIdEntityBox struct {
    *objectbox.Box
}

Box provides CRUD access to TestStringIdEntity objects

func BoxForTestStringIdEntity Uses

func BoxForTestStringIdEntity(ob *objectbox.ObjectBox) *TestStringIdEntityBox

BoxForTestStringIdEntity opens a box of TestStringIdEntity objects

func (*TestStringIdEntityBox) Get Uses

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 Uses

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

GetAll reads all stored objects

func (*TestStringIdEntityBox) GetMany Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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

Remove deletes a single object

func (*TestStringIdEntityBox) RemoveMany Uses

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 Uses

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 Uses

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

Find returns all objects matching the query

func (*TestStringIdEntityQuery) Limit Uses

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

Limit sets the number of elements to process by the query

func (*TestStringIdEntityQuery) Offset Uses

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

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

Directories

PathSynopsis
iot

Package model imports 12 packages (graph). Updated 2019-09-06. Refresh now. Tools for package owners.