Closed ghost closed 3 years ago
This error happens when you call put with a non-existent ID, i.e. you're currently creating an object that wasn't before in the database. Does that describe your situation? If that's the case, see if you can change the object's ID to zero before calling box.Put(), it'll assign a new ID automatically
So-called self-assigned ID's aren't currently supported in objectbox-go binding
Hi @vaind and thanks for the quick reply. Yes, your correct: I was attempting to use my own generated IDs for objects. I was somehow under the impression that this is possible in the Go version too.
Any chance you guys could make IDs assignable in the Go library as well (I believe the Java version has this) ?
This is now available with v1.3.0:
type Entity struct {
Id uint64 `objectbox:"id(assignable)"`
}
ID is higher or equal to internal ID sequence: 3462622074874930866 (vs. 1). Use ID 0 (zero) to insert new entities.