MCPcopy Create free account
hub / github.com/golang/appengine / TestSimpleQuery

Function TestSimpleQuery

datastore/query_test.go:211–337  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

209}
210
211func TestSimpleQuery(t *testing.T) {
212 struct1 := Gopher{Name: "George", Height: 32}
213 struct2 := Gopher{Name: "Rufus"}
214 pList1 := PropertyList{
215 {
216 Name: "Name",
217 Value: "George",
218 },
219 {
220 Name: "Height",
221 Value: int64(32),
222 },
223 }
224 pList2 := PropertyList{
225 {
226 Name: "Name",
227 Value: "Rufus",
228 },
229 }
230 pMap1 := PropertyMap{
231 "Name": Property{
232 Name: "Name",
233 Value: "George",
234 },
235 "Height": Property{
236 Name: "Height",
237 Value: int64(32),
238 },
239 }
240 pMap2 := PropertyMap{
241 "Name": Property{
242 Name: "Name",
243 Value: "Rufus",
244 },
245 }
246
247 testCases := []struct {
248 dst interface{}
249 want interface{}
250 }{
251 // The destination must have type *[]P, *[]S or *[]*S, for some non-interface
252 // type P such that *P implements PropertyLoadSaver, or for some struct type S.
253 {new([]Gopher), &[]Gopher{struct1, struct2}},
254 {new([]*Gopher), &[]*Gopher{&struct1, &struct2}},
255 {new([]PropertyList), &[]PropertyList{pList1, pList2}},
256 {new([]PropertyMap), &[]PropertyMap{pMap1, pMap2}},
257
258 // Any other destination type is invalid.
259 {0, nil},
260 {Gopher{}, nil},
261 {PropertyList{}, nil},
262 {PropertyMap{}, nil},
263 {[]int{}, nil},
264 {[]Gopher{}, nil},
265 {[]PropertyList{}, nil},
266 {new(int), nil},
267 {new(Gopher), nil},
268 {new(PropertyList), nil}, // This is a special case.

Callers

nothing calls this directly

Calls 8

FakeSingleContextFunction · 0.92
WithAppIDOverrideFunction · 0.92
fakeRunQueryFunction · 0.70
NewQueryFunction · 0.70
NewKeyFunction · 0.70
keysEqualFunction · 0.70
GetAllMethod · 0.45
AppIDMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…