func (env *TestEnv) PutEntity(entity *Entity) uint64 {
	id, err := env.Box.Put(entity)
	assert.NoErr(env.t, err)
	return id
}
PutEntity creates an entity
package model
import (
	"fmt"
	"io/ioutil"
	"os"
	"strings"
	"testing"
	"github.com/objectbox/objectbox-go/objectbox"
	"github.com/objectbox/objectbox-go/test/assert"
)
type TestEnv struct {
	ObjectBox *objectbox.ObjectBox
	Box       *EntityBox
	Directory string
	t       *testing.T
	options TestEnvOptions
}
type TestEnvOptions struct {
	PopulateRelations bool
}
func NewTestEnv(t *testing.T) *TestEnv {
	tempDir, err := ioutil.TempDir("", "objectbox-test")
	if err != nil {
		t.Fatal(err)
	}
	var env = &TestEnv{
		Directory: tempDir,
		t:         t,
	}
	env.ObjectBox, err = objectbox.NewBuilder().Directory(env.Directory).Model(ObjectBoxModel()).Build()
	if err != nil {
		t.Fatal(err)
	}
	env.Box = BoxForEntity(env.ObjectBox)
	return env
}
func (env *TestEnv) Close() {
	env.ObjectBox.Close()
	os.RemoveAll(env.Directory)
}
func (env *TestEnv) SyncClient(serverUri string) *objectbox.SyncClient {
	client, err := objectbox.NewSyncClient(env.ObjectBox, serverUri, objectbox.SyncCredentialsNone())
	assert.NoErr(env.t, err)
	assert.True(env.t, client != nil)
	return client
}
func removeFileIfExists(path string) error {
	if _, err := os.Stat(path); err == nil {
		return os.Remove(path)
	}
	return nil
}
func (env *TestEnv) SetOptions(options TestEnvOptions) *TestEnv {
	env.options = options
	return env
}
func (env *TestEnv) Populate(count uint) {
	env.PutEntity(entity47(1, &env.options))
	if count > 1 {
		var e = entity47(1, &env.options)
		e.String = strings.ToUpper(e.String)
		env.PutEntity(e)
	}
	if count > 2 {
		var toInsert = count - 2
		var limit = float64(4294967295)  
		var step = limit / float64(toInsert) * 2
		var entities = make([]*Entity, toInsert)
		var i = uint(0)
		for coef := -limit; i < toInsert; coef += step {
			entities[i] = entity47(int64(coef), &env.options)
			i++
		}
		_, err := env.Box.PutMany(entities)
		assert.NoErr(env.t, err)
	}
	c, err := env.Box.Count()
	assert.NoErr(env.t, err)
	assert.Eq(env.t, uint64(count), c)
}