Closed davedbase closed 4 years ago
Yep, you can query nested fields like that.
https://github.com/timshannon/badgerhold/blob/master/query.go#L251
It basically splits the field name on .
and loops to get nested field values. Is that not working for you?
Thanks Tim. Once I get home I'll have a better look at it but when I originally tested it, the period split didn't work. I'll confirm and supply a testable case.
Will the field split if one of my fields is map[string]interface{}
? ie:
type Document struct {
Type string
Title string
Content string
Excerpt string
Reference string
Status string
Metadata map[string]interface{}
Created time.Time
Updated time.Time
}
Judging by the fieldValue method, looks like it's only reflecting on the struct fields and not maps.
Just sorting out a couple different methods to work with BadgerHold. I'd like to use the Triplestore method but I'm also sensitive to performance.
I was going to implement a document store and a triplestore to see how effective either is for my use case. I'm assuming the document store would be faster.
Yep, currently it only works with Stuct fields.
Disregard, I had a bug in my logic. The dot notation for properties seems to be working fine. :-)
I was wondering if a structure like this would be possible or if you someone suggest a better structure:
Basically with this layout I'd have to do the following:
The reason for this structure is that my Subject and Object properties can actually be references to other records. Perhaps it's best to keep Subject and Object as interfaces{} and use a MatchFunc to check the type is a UUID?