| Index: go/src/infra/gae/libs/gae/memory/datastore_query.go
|
| diff --git a/go/src/infra/gae/libs/gae/memory/datastore_query.go b/go/src/infra/gae/libs/gae/memory/datastore_query.go
|
| index b8df9dc20db2977496b2e4765d578d47147e3b91..ae2f4f9aad9d6c920b5dfe907b0db03aa2252d99 100644
|
| --- a/go/src/infra/gae/libs/gae/memory/datastore_query.go
|
| +++ b/go/src/infra/gae/libs/gae/memory/datastore_query.go
|
| @@ -218,18 +218,19 @@ func (q queryCursor) String() string { return string(q) }
|
| func (q queryCursor) Valid() bool { return q != "" }
|
|
|
| type queryImpl struct {
|
| - gae.DSQuery
|
| -
|
| ns string
|
|
|
| kind string
|
| ancestor gae.DSKey
|
| filter []queryFilter
|
| order []queryOrder
|
| + project []string
|
|
|
| - keysOnly bool
|
| - limit int32
|
| - offset int32
|
| + distinct bool
|
| + eventualConsistency bool
|
| + keysOnly bool
|
| + limit int32
|
| + offset int32
|
|
|
| start queryCursor
|
| end queryCursor
|
| @@ -237,6 +238,8 @@ type queryImpl struct {
|
| err error
|
| }
|
|
|
| +var _ gae.DSQuery = (*queryImpl)(nil)
|
| +
|
| type queryIterImpl struct {
|
| idx *queryImpl
|
| }
|
| @@ -469,6 +472,7 @@ func (q *queryImpl) clone() *queryImpl {
|
| ret := *q
|
| ret.filter = append([]queryFilter(nil), q.filter...)
|
| ret.order = append([]queryOrder(nil), q.order...)
|
| + ret.project = append([]string(nil), q.project...)
|
| return &ret
|
| }
|
|
|
| @@ -489,6 +493,12 @@ func (q *queryImpl) Ancestor(k gae.DSKey) gae.DSQuery {
|
| return q
|
| }
|
|
|
| +func (q *queryImpl) Distinct() gae.DSQuery {
|
| + q = q.clone()
|
| + q.distinct = true
|
| + return q
|
| +}
|
| +
|
| func (q *queryImpl) Filter(fStr string, val interface{}) gae.DSQuery {
|
| q = q.clone()
|
| f, err := parseFilter(fStr, val)
|
| @@ -519,6 +529,12 @@ func (q *queryImpl) Order(field string) gae.DSQuery {
|
| return q
|
| }
|
|
|
| +func (q *queryImpl) Project(fieldName ...string) gae.DSQuery {
|
| + q = q.clone()
|
| + q.project = append(q.project, fieldName...)
|
| + return q
|
| +}
|
| +
|
| func (q *queryImpl) KeysOnly() gae.DSQuery {
|
| q = q.clone()
|
| q.keysOnly = true
|
| @@ -570,3 +586,9 @@ func (q *queryImpl) End(c gae.DSCursor) gae.DSQuery {
|
| q.end = curs
|
| return q
|
| }
|
| +
|
| +func (q *queryImpl) EventualConsistency() gae.DSQuery {
|
| + q = q.clone()
|
| + q.eventualConsistency = true
|
| + return q
|
| +}
|
|
|