| 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 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 eqFilts: q.eqFilts, | 562 eqFilts: q.eqFilts, |
| 563 | 563 |
| 564 ineqFiltProp: q.ineqFiltProp, | 564 ineqFiltProp: q.ineqFiltProp, |
| 565 ineqFiltLow: q.ineqFiltLow, | 565 ineqFiltLow: q.ineqFiltLow, |
| 566 ineqFiltLowIncl: q.ineqFiltLowIncl, | 566 ineqFiltLowIncl: q.ineqFiltLowIncl, |
| 567 ineqFiltLowSet: q.ineqFiltLowSet, | 567 ineqFiltLowSet: q.ineqFiltLowSet, |
| 568 ineqFiltHigh: q.ineqFiltHigh, | 568 ineqFiltHigh: q.ineqFiltHigh, |
| 569 ineqFiltHighIncl: q.ineqFiltHighIncl, | 569 ineqFiltHighIncl: q.ineqFiltHighIncl, |
| 570 ineqFiltHighSet: q.ineqFiltHighSet, | 570 ineqFiltHighSet: q.ineqFiltHighSet, |
| 571 } | 571 } |
| 572 // If a starting cursor is provided, ignore the offset, as it would have
been |
| 573 // accounted for in the query that produced the cursor. |
| 574 if ret.start != nil { |
| 575 ret.offset = nil |
| 576 } |
| 572 | 577 |
| 573 if q.project != nil { | 578 if q.project != nil { |
| 574 ret.project = q.project.ToSlice() | 579 ret.project = q.project.ToSlice() |
| 575 ret.distinct = q.distinct && q.project.Len() > 0 | 580 ret.distinct = q.distinct && q.project.Len() > 0 |
| 576 | 581 |
| 577 // If we're DISTINCT && have an inequality filter, we must proje
ct that | 582 // If we're DISTINCT && have an inequality filter, we must proje
ct that |
| 578 // inequality property as well. | 583 // inequality property as well. |
| 579 if ret.distinct && ret.ineqFiltProp != "" && !q.project.Has(ret.
ineqFiltProp) { | 584 if ret.distinct && ret.ineqFiltProp != "" && !q.project.Has(ret.
ineqFiltProp) { |
| 580 ret.project = append([]string{ret.ineqFiltProp}, ret.pro
ject...) | 585 ret.project = append([]string{ret.ineqFiltProp}, ret.pro
ject...) |
| 581 } | 586 } |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 if q.keysOnly { | 738 if q.keysOnly { |
| 734 p("KeysOnly") | 739 p("KeysOnly") |
| 735 } | 740 } |
| 736 | 741 |
| 737 if _, err := ret.WriteRune(')'); err != nil { | 742 if _, err := ret.WriteRune(')'); err != nil { |
| 738 panic(err) | 743 panic(err) |
| 739 } | 744 } |
| 740 | 745 |
| 741 return ret.String() | 746 return ret.String() |
| 742 } | 747 } |
| OLD | NEW |