uint64to efficiently get or reference objects. ObjectBox recognizes this automatically if your entity has a
uint64field named ID (case insensitive).
idannotation on a
uint64property with any name in your entity:
Put()and automatically assigns an ID.
objectbox:"id(assignable)"annotation. This will allow putting an object with any valid ID. You can still set the ID to zero to let ObjectBox auto-assign a new ID.
stringproperties are typically taking more space than scalar values, ObjectBox is using hash for strings by default.
String,this may require more storage than a hash-based index.
hash64, as it requires less storage.
hashand thus should not be the first choice in most cases.
put()operation will abort and return an error if the unique constraint is violated.
Taskin the following example will internally end up with four fields, "id", "meta_created", "meta_modified" and "text".
time.Timefield, it's automatically recognized as a date and the code generator will use the built-in converter and store the field internally as a Unix timestamp.
datebut storing the timestamp as nanoseconds since UNIX epoch.
date-nanofield. TS enabled types require this special companion property. For more information about how to use ObjectBox TS (Time Series), please refer to the C++ TS APIs for now.
go generateinside the directory that contains the files with the entities.
objectbox-model.jsonin your package, which you should add to your version control system (e.g. git).