Chromium Code Reviews| 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 "math" | 8 "math" |
| 9 "testing" | 9 "testing" |
| 10 | 10 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 {"projecting a duplicate (style 2)", | 138 {"projecting a duplicate (style 2)", |
| 139 nq().Project("hello").Project("hello"), | 139 nq().Project("hello").Project("hello"), |
| 140 "SELECT `hello` FROM `Foo` ORDER BY `hello`, `__key__`", | 140 "SELECT `hello` FROM `Foo` ORDER BY `hello`, `__key__`", |
| 141 nil, nq().Project("hello")}, | 141 nil, nq().Project("hello")}, |
| 142 | 142 |
| 143 {"project distinct", | 143 {"project distinct", |
| 144 nq().Project("hello").Distinct(true), | 144 nq().Project("hello").Distinct(true), |
| 145 "SELECT DISTINCT `hello` FROM `Foo` ORDER BY `hello`, `__key__`" , | 145 "SELECT DISTINCT `hello` FROM `Foo` ORDER BY `hello`, `__key__`" , |
| 146 nil, nil}, | 146 nil, nil}, |
| 147 | 147 |
| 148 {"projecting in an inequality query", | |
| 149 nq().Gte("foo", 10).Project("bar").Distinct(true), | |
| 150 "SELECT DISTINCT `bar` FROM `Foo` WHERE `foo` >= 10 ORDER BY `fo o`, `bar`, `__key__`", | |
|
iannucci
2016/02/27 01:02:02
this is wrong though, it should DISTINCT `foo`, `b
| |
| 151 nil, nil}, | |
| 152 | |
| 148 {"bad ancestors", | 153 {"bad ancestors", |
| 149 nq().Ancestor(mkKey("goop", 0)), | 154 nq().Ancestor(mkKey("goop", 0)), |
| 150 "", | 155 "", |
| 151 ErrInvalidKey, nil}, | 156 ErrInvalidKey, nil}, |
| 152 | 157 |
| 153 {"nil ancestors", | 158 {"nil ancestors", |
| 154 nq().Ancestor(nil), | 159 nq().Ancestor(nil), |
| 155 "SELECT * FROM `Foo` ORDER BY `__key__`", | 160 "SELECT * FROM `Foo` ORDER BY `__key__`", |
| 156 nil, nq()}, | 161 nil, nq()}, |
| 157 | 162 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 328 So(err, ShouldBeNil) | 333 So(err, ShouldBeNil) |
| 329 | 334 |
| 330 fq.original = nil | 335 fq.original = nil |
| 331 fq2.original = nil | 336 fq2.original = nil |
| 332 So(fq, ShouldResemble, fq2) | 337 So(fq, ShouldResemble, fq2) |
| 333 } | 338 } |
| 334 }) | 339 }) |
| 335 } | 340 } |
| 336 }) | 341 }) |
| 337 } | 342 } |
| OLD | NEW |