db can query 1 level nested dotnotation
This commit is contained in:
@@ -46,4 +46,15 @@ func TestDB(t *testing.T) {
|
||||
} else if gots[1].K != "b" {
|
||||
t.Errorf("expected [1]='b' but got %q", gots[1].K)
|
||||
}
|
||||
|
||||
type NestedResult struct {
|
||||
Nest struct {
|
||||
K string `json:"k"`
|
||||
}
|
||||
}
|
||||
if got, err := db.QueryOne[NestedResult](ctx, `SELECT k AS "Nest.k" FROM test WHERE k='a'`); err != nil {
|
||||
t.Errorf("failed nested query one: %v", err)
|
||||
} else if got.Nest.K != "a" {
|
||||
t.Errorf("bad nested query one: %+v", got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user