Closed delaneyj closed 3 years ago
Annotations are space separated, so a working example would look like this:
type Foo struct {
ID uint64 `objectbox:"id"`
Name string `objectbox:"index unique"`
}
Also note there's no point in combining index and unique unless you specify a non-default index type (https://golang.objectbox.io/entity-annotations#index-types-string). Unique annotation implies index automatically and uses the default index type based on the variable type ("hash" for strings).
Would you see be any disadvantage in being more tolerant here, e.g. using comma OR space?
json,bson,etc use the comma. Iirc its not defined in the go spec. @vaind, didn't know if the unique cause effected .Put calls or created an index. Thought it might but far as I saw it wasn't documented.
So we should also support commas...
It's not mentioned in the docs if unique cause an index to be generated so I added to the tagged literal but this doesn't seem to be support at this time.
Generation give
can't prepare bindings for feeds.go: unknown annotation index,unique on property Name found in Foo