Custom types
Sometimes, you need to store a type that can't be handled out of the box. ObjectBox let's you define a custom converter (a pair of functions) that takes care of encoding & decoding properties.
int, int8, int16, int32, int64
uint, uint8, uint16, uint32, uint64
bool
string, []string
byte, []byte
rune
float32, float64Defining a converter
type Task struct {
Id uint64
Text string
DateCreated time.Time `objectbox:"date type:int64 converter:timeInt64"`
}// from DB value to runtime value
func timeInt64ToEntityProperty(dbValue int64) (time.Time, error)
// from runtime value to DB value
func timeInt64ToDatabaseValue(goValue time.Time) (int64, error)Queries on custom types
Things to look out for
Last updated