You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As it is, one can add a index tag to a slice field, and the whole slice will be used as a key in the index - which is expected, but not very useful. It would be nice to have a sliceindex tag which build an index where each value of the slice is inserted in the index.
type Post struct {
ID int `storm:"increment"`
Tags []string{} `storm:"sliceindex"`
Text string
}
// db contains several entries with various tags ...
// returns posts which contain the tag "foo"
var foo []Post
db.Find("Tags", "foo", &foo)
// returns posts which contain the tags "foo" and "bar"
var fooBar []Post
db.Find("Tags", []string{"foo", "bar"})
Well, I guess it is already possible to do just that with a separate bucket associating Tags and post IDs, but I think this would make what I see as a very common use case much easier to do.
The text was updated successfully, but these errors were encountered:
As it is, one can add a
index
tag to a slice field, and the whole slice will be used as a key in the index - which is expected, but not very useful. It would be nice to have asliceindex
tag which build an index where each value of the slice is inserted in the index.Well, I guess it is already possible to do just that with a separate bucket associating Tags and post IDs, but I think this would make what I see as a very common use case much easier to do.
The text was updated successfully, but these errors were encountered: