given
type Person struct {
PersonID string `json:"person_id"`
First string `json:"first"`
Middle string `json:"middle"`
Last string `json:"last"`
}
func (p Person) String() string {
return fmt.Sprintf("%s %s %s %s", p.PersonID, p.First, p.Middle, p.Last)
}
func (p Person) ID() (jsonField string, value interface{}) {
value=p.PersonID
jsonField="personID"
return
}
And I add records:
driver, err := simdb.New("D:\\_MUSIC\\person")
if err != nil {
panic(err)
}
person1 := Person{
PersonID: "1",
First: "John",
Middle: "Q",
Last: "Smith",
}
person2 := Person{
PersonID: "2",
First: "Suzy",
Middle: "Q",
Last: "Smith",
}
driver.Insert(person1)
driver.Insert(person2)
When querying a single element, I get the expected results:
people := []Person{}
driver.Open(Person{}).Where("last","eq","Smith").Get().AsEntity(&people)
fmt.Println(people)
Output: [1 John Q Smith 2 Suzy Q Smith]
But when I combine queries, I get empty results:
people = []Person{}
driver.Open(Person{}).Where("last","==","Smith").Where("first","==","Suzy").Get().AsEntity(&people)
fmt.Println(people)
Output: []
I'm expecting: [1 John Q Smith 2 Suzy Q Smith]
given
And I add records:
When querying a single element, I get the expected results:
Output:
[1 John Q Smith 2 Suzy Q Smith]But when I combine queries, I get empty results:
Output:
[]I'm expecting:
[1 John Q Smith 2 Suzy Q Smith]