OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package datastore | 5 package datastore |
6 | 6 |
7 import ( | 7 import ( |
8 "bytes" | 8 "bytes" |
9 "fmt" | 9 "fmt" |
10 "sort" | 10 "sort" |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 if len(q.project) != 0 { | 233 if len(q.project) != 0 { |
234 if q.distinct { | 234 if q.distinct { |
235 ws(" DISTINCT") | 235 ws(" DISTINCT") |
236 } | 236 } |
237 proj := make([]string, len(q.project)) | 237 proj := make([]string, len(q.project)) |
238 for i, p := range q.project { | 238 for i, p := range q.project { |
239 proj[i] = gqlQuoteName(p) | 239 proj[i] = gqlQuoteName(p) |
240 } | 240 } |
241 ws(" ") | 241 ws(" ") |
242 ws(strings.Join(proj, ", ")) | 242 ws(strings.Join(proj, ", ")) |
| 243 } else if q.keysOnly { |
| 244 ws(" __key__") |
243 } else { | 245 } else { |
244 ws(" *") | 246 ws(" *") |
245 } | 247 } |
246 | 248 |
247 if q.kind != "" { | 249 if q.kind != "" { |
248 fmt.Fprintf(&ret, " FROM %s", gqlQuoteName(q.kind)) | 250 fmt.Fprintf(&ret, " FROM %s", gqlQuoteName(q.kind)) |
249 } | 251 } |
250 | 252 |
251 filts := []string(nil) | 253 filts := []string(nil) |
252 anc := Property{} | 254 anc := Property{} |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 if q.ineqFiltProp == "__key__" { | 330 if q.ineqFiltProp == "__key__" { |
329 if q.ineqFiltLowSet && !q.ineqFiltLow.Value().(*Key).Valid(false
, aid, ns) { | 331 if q.ineqFiltLowSet && !q.ineqFiltLow.Value().(*Key).Valid(false
, aid, ns) { |
330 return ErrInvalidKey | 332 return ErrInvalidKey |
331 } | 333 } |
332 if q.ineqFiltHighSet && !q.ineqFiltHigh.Value().(*Key).Valid(fal
se, aid, ns) { | 334 if q.ineqFiltHighSet && !q.ineqFiltHigh.Value().(*Key).Valid(fal
se, aid, ns) { |
333 return ErrInvalidKey | 335 return ErrInvalidKey |
334 } | 336 } |
335 } | 337 } |
336 return nil | 338 return nil |
337 } | 339 } |
OLD | NEW |