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 memory | 5 package memory |
6 | 6 |
7 import ( | 7 import ( |
8 "fmt" | 8 "fmt" |
9 "testing" | 9 "testing" |
10 "time" | 10 "time" |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 } | 534 } |
535 | 535 |
536 func TestCompoundIndexes(t *testing.T) { | 536 func TestCompoundIndexes(t *testing.T) { |
537 t.Parallel() | 537 t.Parallel() |
538 | 538 |
539 idxKey := func(def dsS.IndexDefinition) string { | 539 idxKey := func(def dsS.IndexDefinition) string { |
540 So(def, ShouldNotBeNil) | 540 So(def, ShouldNotBeNil) |
541 return "idx::" + string(serialize.ToBytes(*def.PrepForIdxTable()
)) | 541 return "idx::" + string(serialize.ToBytes(*def.PrepForIdxTable()
)) |
542 } | 542 } |
543 | 543 |
544 » numItms := func(c *memCollection) uint64 { | 544 » numItms := func(c memCollection) uint64 { |
545 ret, _ := c.GetTotals() | 545 ret, _ := c.GetTotals() |
546 return ret | 546 return ret |
547 } | 547 } |
548 | 548 |
549 Convey("Test Compound indexes", t, func() { | 549 Convey("Test Compound indexes", t, func() { |
550 type Model struct { | 550 type Model struct { |
551 ID int64 `gae:"$id"` | 551 ID int64 `gae:"$id"` |
552 | 552 |
553 Field1 []string | 553 Field1 []string |
554 Field2 []int64 | 554 Field2 []int64 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 // Add "foos" to a new namesapce, then confirm that it g
ets indexed. | 677 // Add "foos" to a new namesapce, then confirm that it g
ets indexed. |
678 So(dsS.Get(infoS.Get(ctx).MustNamespace("qux")).PutMulti
(foos), ShouldBeNil) | 678 So(dsS.Get(infoS.Get(ctx).MustNamespace("qux")).PutMulti
(foos), ShouldBeNil) |
679 dsS.Get(ctx).Testable().CatchupIndexes() | 679 dsS.Get(ctx).Testable().CatchupIndexes() |
680 | 680 |
681 results = nil | 681 results = nil |
682 So(dsS.Get(infoS.Get(ctx).MustNamespace("qux")).GetAll(q
, &results), ShouldBeNil) | 682 So(dsS.Get(infoS.Get(ctx).MustNamespace("qux")).GetAll(q
, &results), ShouldBeNil) |
683 So(len(results), ShouldEqual, 2) | 683 So(len(results), ShouldEqual, 2) |
684 }) | 684 }) |
685 }) | 685 }) |
686 } | 686 } |
OLD | NEW |