func init() { cb := func(i int64) string { buf := &bytes.Buffer{} cmpbin.WriteInt(buf, i) return buf.String() } rs := rand.NewSource(0) root := datastore.MakeKey("something~else", "", "Parent", 1) nums := make([]string, 20) for i := range dataMultiRoot { id := int64(i + 1) nums[i] = cb(id) val := make([]int64, rs.Int63()%20) for j := range val { r := rs.Int63() val[j] = r } dataMultiRoot[i] = &Foo{ID: id, Value: val} dataSingleRoot[i] = &Foo{ID: id, Parent: root, Value: val} } for i := range hugeField { hugeField[i] = byte(i) } for i := range hugeData { hugeData[i] = &Foo{ID: int64(i + 1), ValueNI: hugeField} } }
func key(elems ...interface{}) *ds.Key { return ds.MakeKey("dev~app", "ns", elems...) }
} if data, ok := values[0].([]byte); ok { f.ValueNI = data } else { f.Value = toIntSlice(values) } return ShouldBeNil(ds.Put(f)) } } var ( dataMultiRoot = make([]*Foo, 20) dataSingleRoot = make([]*Foo, 20) hugeField = make([]byte, DefaultSizeBudget/8) hugeData = make([]*Foo, 11) root = datastore.MakeKey("something~else", "", "Parent", 1) ) func init() { cb := func(i int64) string { buf := &bytes.Buffer{} cmpbin.WriteInt(buf, i) return buf.String() } rs := rand.NewSource(0) root := datastore.MakeKey("something~else", "", "Parent", 1) nums := make([]string, 20) for i := range dataMultiRoot { id := int64(i + 1) nums[i] = cb(id)