func (model *Model) RegisterBinding(binding ObjectBinding) {
	if model.Error != nil {
		return
	}
	model.currentEntity = nil
	binding.AddToModel(model)
	if model.currentEntity == nil {
		model.Error = fmt.Errorf("invalid binding - model.Entity() not called")
		return
	}
	id := model.currentEntity.id
	name := model.currentEntity.name
	if id == 0 {
		model.Error = fmt.Errorf("invalid binding - entity id is not set")
		return
	}
	if name == "" {
		model.Error = fmt.Errorf("invalid binding - entity name is not set")
		return
	}
	if model.entitiesById[id] != nil {
		model.Error = fmt.Errorf("duplicate binding - entity id %d is already registered", id)
		return
	}
	if model.entitiesByName[name] != nil {
		model.Error = fmt.Errorf("duplicate binding - entity name %s is already registered", name)
		return
	}
	var version = binding.GeneratorVersion()
	if version != gogen.VersionId {
		model.Error = fmt.Errorf("incompatible generator version %d used to generate the binding %s code "+
			"- please follow the upgrade procedure described in the README.md", version, name)
		return
	}
	model.currentEntity.binding = binding
	model.entitiesById[id] = model.currentEntity
	model.entitiesByName[name] = model.currentEntity
	model.currentEntity = nil
}
RegisterBinding attaches generated binding code to the model.
The binding is used by ObjectBox for marshalling and other typed operations.
package objectbox
import "C"
import (
	"fmt"
	"unsafe"
	"github.com/google/flatbuffers/go"
	"github.com/objectbox/objectbox-generator/cmd/objectbox-gogen"
)
type ObjectBinding interface {
	AddToModel(model *Model)
	GetId(object interface{}) (id uint64, err error)
	SetId(object interface{}, id uint64) error
	PutRelated(ob *ObjectBox, object interface{}, id uint64) error
	Flatten(object interface{}, fbb *flatbuffers.Builder, id uint64) error
	Load(ob *ObjectBox, bytes []byte) (interface{}, error)
	MakeSlice(capacity int) interface{}
	AppendToSlice(slice interface{}, object interface{}) (sliceNew interface{})
	GeneratorVersion() int
}
type Model struct {
	cModel *C.OBX_model
	Error  error
	currentEntity  *entity
	entitiesById   map[TypeId]*entity
	entitiesByName map[string]*entity
	lastEntityId  TypeId
	lastEntityUid uint64
	lastIndexId  TypeId
	lastIndexUid uint64
	lastRelationId  TypeId
	lastRelationUid uint64
	generatorVersion int
}
func NewModel() *Model {
	var model = &Model{
		entitiesById:   make(map[TypeId]*entity),
		entitiesByName: make(map[string]*entity),
	}
	model.Error = cCallBool(func() bool {
		model.cModel = C.obx_model()
		return model.cModel != nil
	})
	return model
}
func (model *Model) GeneratorVersion(version int) {
	if model.Error != nil {
		return
	}
	model.generatorVersion = version
}
func (model *Model) LastEntityId(id TypeId, uid uint64) {
	if model.Error != nil {
		return
	}
	model.lastEntityId = id
	model.lastEntityUid = uid
	C.obx_model_last_entity_id(model.cModel, C.obx_schema_id(id), C.obx_uid(uid))
}
func (model *Model) LastIndexId(id TypeId, uid uint64) {
	if model.Error != nil {
		return
	}
	model.lastIndexId = id
	model.lastIndexUid = uid
	C.obx_model_last_index_id(model.cModel, C.obx_schema_id(id), C.obx_uid(uid))
}
func (model *Model) LastRelationId(id TypeId, uid uint64) {
	if model.Error != nil {
		return
	}
	model.lastRelationId = id
	model.lastRelationUid = uid
	C.obx_model_last_relation_id(model.cModel, C.obx_schema_id(id), C.obx_uid(uid))
}
func (model *Model) Entity(name string, id TypeId, uid uint64) {
	if model.Error != nil {
		return
	}
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))
	if err := cCall(func() C.obx_err {
		return C.obx_model_entity(model.cModel, cname, C.obx_schema_id(id), C.obx_uid(uid))
	}); err != nil {
		model.Error = err
		return
	}
	model.currentEntity = &entity{
		name: name,
		id:   id,
	}
}
func (model *Model) EntityFlags(entityFlags int) {
	if model.Error != nil {
		return
	}
	model.Error = cCall(func() C.obx_err {
		return C.obx_model_entity_flags(model.cModel, C.OBXEntityFlags(entityFlags))
	})
}
func (model *Model) Relation(relationId TypeId, relationUid uint64, targetEntityId TypeId, targetEntityUid uint64) {
	if model.Error != nil {
		return
	}
	model.Error = cCall(func() C.obx_err {
		return C.obx_model_relation(model.cModel, C.obx_schema_id(relationId), C.obx_uid(relationUid),
			C.obx_schema_id(targetEntityId), C.obx_uid(targetEntityUid))
	})
	model.currentEntity.hasRelations = true
}
func (model *Model) EntityLastPropertyId(id TypeId, uid uint64) {
	if model.Error != nil {
		return
	}
	model.Error = cCall(func() C.obx_err {
		return C.obx_model_entity_last_property_id(model.cModel, C.obx_schema_id(id), C.obx_uid(uid))
	})
}
func (model *Model) Property(name string, propertyType int, id TypeId, uid uint64) {
	if model.Error != nil {
		return
	}
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))
	model.Error = cCall(func() C.obx_err {
		return C.obx_model_property(model.cModel, cname, C.OBXPropertyType(propertyType), C.obx_schema_id(id), C.obx_uid(uid))
	})
}
func (model *Model) PropertyFlags(propertyFlags int) {
	if model.Error != nil {
		return
	}
	model.Error = cCall(func() C.obx_err {
		return C.obx_model_property_flags(model.cModel, C.OBXPropertyFlags(propertyFlags))
	})
}
func (model *Model) PropertyIndex(id TypeId, uid uint64) {
	if model.Error != nil {
		return
	}
	model.Error = cCall(func() C.obx_err {
		return C.obx_model_property_index_id(model.cModel, C.obx_schema_id(id), C.obx_uid(uid))
	})
}
func (model *Model) PropertyRelation(targetEntityName string, indexId TypeId, indexUid uint64) {
	if model.Error != nil {
		return
	}
	cname := C.CString(targetEntityName)
	defer C.free(unsafe.Pointer(cname))
	model.Error = cCall(func() C.obx_err {
		return C.obx_model_property_relation(model.cModel, cname, C.obx_schema_id(indexId), C.obx_uid(indexUid))
	})
	model.currentEntity.hasRelations = true
}