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
Hello everyone! Love the package! But stuck with a weird problem -- can't get q.In to work, perhaps I'm doing something wrong, or perhaps I've hit a bug in the library, can someone please help?
package main
import (
"fmt"
"log"
"github.com/asdine/storm"
"github.com/asdine/storm/q"
)
type Foo struct {
Id int64 `storm:"id,increment"`
Title string `storm:"index"`
Tags []string `storm:"index"`
}
func main() {
if db, e := storm.Open("db/test.db"); e != nil {
log.Fatal("Couldn't open database")
} else {
defer db.Close()
db.Save(&Foo{Title: "Lorem", Tags: []string{"foo", "bar"}})
db.Save(&Foo{Title: "Ipsum", Tags: []string{"foo", "bax"}})
db.Save(&Foo{Title: "Doler", Tags: []string{"quux", "baz"}})
{
var a []Foo
if e := db.Select().Find(&a); e != nil {
panic(e)
} else {
fmt.Println(a)
}
}
{
var a Foo
if e := db.One("Title", "Lorem", &a); e != nil {
panic(e)
}
}
{
var a []Foo
if e := db.Select(q.In("Tags", []string{"quux"})).Find(&a); e != nil {
panic(e) // yikes
}
}
}
}
The text was updated successfully, but these errors were encountered:
Hello everyone! Love the package! But stuck with a weird problem -- can't get q.In to work, perhaps I'm doing something wrong, or perhaps I've hit a bug in the library, can someone please help?
The text was updated successfully, but these errors were encountered: