mirror of https://github.com/tidwall/tile38.git
Remove created field
This commit is contained in:
parent
2c643996e7
commit
def9c173bf
|
@ -196,7 +196,7 @@ func (c *Collection) Set(obj *object.Object) (prev *object.Object) {
|
||||||
// Delete removes an object and returns it.
|
// Delete removes an object and returns it.
|
||||||
// If the object does not exist then the 'ok' return value will be false.
|
// If the object does not exist then the 'ok' return value will be false.
|
||||||
func (c *Collection) Delete(id string) (prev *object.Object) {
|
func (c *Collection) Delete(id string) (prev *object.Object) {
|
||||||
key := object.New(id, nil, 0, 0, field.List{})
|
key := object.New(id, nil, 0, field.List{})
|
||||||
prev, _ = c.items.Delete(key)
|
prev, _ = c.items.Delete(key)
|
||||||
if prev == nil {
|
if prev == nil {
|
||||||
return nil
|
return nil
|
||||||
|
@ -221,7 +221,7 @@ func (c *Collection) Delete(id string) (prev *object.Object) {
|
||||||
// Get returns an object.
|
// Get returns an object.
|
||||||
// If the object does not exist then the 'ok' return value will be false.
|
// If the object does not exist then the 'ok' return value will be false.
|
||||||
func (c *Collection) Get(id string) *object.Object {
|
func (c *Collection) Get(id string) *object.Object {
|
||||||
key := object.New(id, nil, 0, 0, field.List{})
|
key := object.New(id, nil, 0, field.List{})
|
||||||
obj, _ := c.items.Get(key)
|
obj, _ := c.items.Get(key)
|
||||||
return obj
|
return obj
|
||||||
}
|
}
|
||||||
|
@ -291,7 +291,7 @@ func (c *Collection) ScanRange(
|
||||||
return keepon
|
return keepon
|
||||||
}
|
}
|
||||||
|
|
||||||
pstart := object.New(start, nil, 0, 0, field.List{})
|
pstart := object.New(start, nil, 0, field.List{})
|
||||||
if desc {
|
if desc {
|
||||||
c.items.Descend(pstart, iter)
|
c.items.Descend(pstart, iter)
|
||||||
} else {
|
} else {
|
||||||
|
@ -354,8 +354,8 @@ func (c *Collection) SearchValuesRange(start, end string, desc bool,
|
||||||
return keepon
|
return keepon
|
||||||
}
|
}
|
||||||
|
|
||||||
pstart := object.New("", String(start), 0, 0, field.List{})
|
pstart := object.New("", String(start), 0, field.List{})
|
||||||
pend := object.New("", String(end), 0, 0, field.List{})
|
pend := object.New("", String(end), 0, field.List{})
|
||||||
if desc {
|
if desc {
|
||||||
// descend range
|
// descend range
|
||||||
c.values.Descend(pstart, func(item *object.Object) bool {
|
c.values.Descend(pstart, func(item *object.Object) bool {
|
||||||
|
@ -394,7 +394,7 @@ func (c *Collection) ScanGreaterOrEqual(id string, desc bool,
|
||||||
keepon = iterator(o)
|
keepon = iterator(o)
|
||||||
return keepon
|
return keepon
|
||||||
}
|
}
|
||||||
pstart := object.New(id, nil, 0, 0, field.List{})
|
pstart := object.New(id, nil, 0, field.List{})
|
||||||
if desc {
|
if desc {
|
||||||
c.items.Descend(pstart, iter)
|
c.items.Descend(pstart, iter)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -48,7 +48,7 @@ func TestCollectionNewCollection(t *testing.T) {
|
||||||
id := strconv.FormatInt(int64(i), 10)
|
id := strconv.FormatInt(int64(i), 10)
|
||||||
obj := PO(rand.Float64()*360-180, rand.Float64()*180-90)
|
obj := PO(rand.Float64()*360-180, rand.Float64()*180-90)
|
||||||
objs[id] = obj
|
objs[id] = obj
|
||||||
c.Set(object.New(id, obj, 0, 0, field.List{}))
|
c.Set(object.New(id, obj, 0, field.List{}))
|
||||||
}
|
}
|
||||||
count := 0
|
count := 0
|
||||||
bbox := geometry.Rect{
|
bbox := geometry.Rect{
|
||||||
|
@ -81,31 +81,31 @@ func TestCollectionSet(t *testing.T) {
|
||||||
t.Run("AddString", func(t *testing.T) {
|
t.Run("AddString", func(t *testing.T) {
|
||||||
c := New()
|
c := New()
|
||||||
str1 := String("hello")
|
str1 := String("hello")
|
||||||
old := c.Set(object.New("str", str1, 0, 0, field.List{}))
|
old := c.Set(object.New("str", str1, 0, field.List{}))
|
||||||
expect(t, old == nil)
|
expect(t, old == nil)
|
||||||
})
|
})
|
||||||
t.Run("UpdateString", func(t *testing.T) {
|
t.Run("UpdateString", func(t *testing.T) {
|
||||||
c := New()
|
c := New()
|
||||||
str1 := String("hello")
|
str1 := String("hello")
|
||||||
str2 := String("world")
|
str2 := String("world")
|
||||||
old := c.Set(object.New("str", str1, 0, 0, field.List{}))
|
old := c.Set(object.New("str", str1, 0, field.List{}))
|
||||||
expect(t, old == nil)
|
expect(t, old == nil)
|
||||||
old = c.Set(object.New("str", str2, 0, 0, field.List{}))
|
old = c.Set(object.New("str", str2, 0, field.List{}))
|
||||||
expect(t, old.Geo() == str1)
|
expect(t, old.Geo() == str1)
|
||||||
})
|
})
|
||||||
t.Run("AddPoint", func(t *testing.T) {
|
t.Run("AddPoint", func(t *testing.T) {
|
||||||
c := New()
|
c := New()
|
||||||
point1 := PO(-112.1, 33.1)
|
point1 := PO(-112.1, 33.1)
|
||||||
old := c.Set(object.New("point", point1, 0, 0, field.List{}))
|
old := c.Set(object.New("point", point1, 0, field.List{}))
|
||||||
expect(t, old == nil)
|
expect(t, old == nil)
|
||||||
})
|
})
|
||||||
t.Run("UpdatePoint", func(t *testing.T) {
|
t.Run("UpdatePoint", func(t *testing.T) {
|
||||||
c := New()
|
c := New()
|
||||||
point1 := PO(-112.1, 33.1)
|
point1 := PO(-112.1, 33.1)
|
||||||
point2 := PO(-112.2, 33.2)
|
point2 := PO(-112.2, 33.2)
|
||||||
old := c.Set(object.New("point", point1, 0, 0, field.List{}))
|
old := c.Set(object.New("point", point1, 0, field.List{}))
|
||||||
expect(t, old == nil)
|
expect(t, old == nil)
|
||||||
old = c.Set(object.New("point", point2, 0, 0, field.List{}))
|
old = c.Set(object.New("point", point2, 0, field.List{}))
|
||||||
expect(t, old.Geo().Center() == point1.Base())
|
expect(t, old.Geo().Center() == point1.Base())
|
||||||
})
|
})
|
||||||
t.Run("Fields", func(t *testing.T) {
|
t.Run("Fields", func(t *testing.T) {
|
||||||
|
@ -115,7 +115,7 @@ func TestCollectionSet(t *testing.T) {
|
||||||
fNames := []string{"a", "b", "c"}
|
fNames := []string{"a", "b", "c"}
|
||||||
fValues := []string{"1", "2", "3"}
|
fValues := []string{"1", "2", "3"}
|
||||||
fields1 := toFields(fNames, fValues)
|
fields1 := toFields(fNames, fValues)
|
||||||
old := c.Set(object.New("str", str1, 0, 0, fields1))
|
old := c.Set(object.New("str", str1, 0, fields1))
|
||||||
expect(t, old == nil)
|
expect(t, old == nil)
|
||||||
|
|
||||||
str2 := String("hello")
|
str2 := String("hello")
|
||||||
|
@ -124,23 +124,23 @@ func TestCollectionSet(t *testing.T) {
|
||||||
fValues = []string{"4", "5", "6"}
|
fValues = []string{"4", "5", "6"}
|
||||||
fields2 := toFields(fNames, fValues)
|
fields2 := toFields(fNames, fValues)
|
||||||
|
|
||||||
old = c.Set(object.New("str", str2, 0, 0, fields2))
|
old = c.Set(object.New("str", str2, 0, fields2))
|
||||||
expect(t, old.Geo() == str1)
|
expect(t, old.Geo() == str1)
|
||||||
expect(t, reflect.DeepEqual(old.Fields(), fields1))
|
expect(t, reflect.DeepEqual(old.Fields(), fields1))
|
||||||
|
|
||||||
fNames = []string{"a", "b", "c", "d", "e", "f"}
|
fNames = []string{"a", "b", "c", "d", "e", "f"}
|
||||||
fValues = []string{"7", "8", "9", "10", "11", "12"}
|
fValues = []string{"7", "8", "9", "10", "11", "12"}
|
||||||
fields3 := toFields(fNames, fValues)
|
fields3 := toFields(fNames, fValues)
|
||||||
old = c.Set(object.New("str", str1, 0, 0, fields3))
|
old = c.Set(object.New("str", str1, 0, fields3))
|
||||||
expect(t, old.Geo() == str2)
|
expect(t, old.Geo() == str2)
|
||||||
expect(t, reflect.DeepEqual(old.Fields(), fields2))
|
expect(t, reflect.DeepEqual(old.Fields(), fields2))
|
||||||
})
|
})
|
||||||
t.Run("Delete", func(t *testing.T) {
|
t.Run("Delete", func(t *testing.T) {
|
||||||
c := New()
|
c := New()
|
||||||
|
|
||||||
c.Set(object.New("1", String("1"), 0, 0, field.List{}))
|
c.Set(object.New("1", String("1"), 0, field.List{}))
|
||||||
c.Set(object.New("2", String("2"), 0, 0, field.List{}))
|
c.Set(object.New("2", String("2"), 0, field.List{}))
|
||||||
c.Set(object.New("3", PO(1, 2), 0, 0, field.List{}))
|
c.Set(object.New("3", PO(1, 2), 0, field.List{}))
|
||||||
|
|
||||||
expect(t, c.Count() == 3)
|
expect(t, c.Count() == 3)
|
||||||
expect(t, c.StringCount() == 2)
|
expect(t, c.StringCount() == 2)
|
||||||
|
@ -196,7 +196,7 @@ func TestCollectionScan(t *testing.T) {
|
||||||
c := New()
|
c := New()
|
||||||
for _, i := range rand.Perm(N) {
|
for _, i := range rand.Perm(N) {
|
||||||
id := fmt.Sprintf("%04d", i)
|
id := fmt.Sprintf("%04d", i)
|
||||||
c.Set(object.New(id, String(id), 0, 0, makeFields(
|
c.Set(object.New(id, String(id), 0, makeFields(
|
||||||
field.Make("ex", id),
|
field.Make("ex", id),
|
||||||
)))
|
)))
|
||||||
}
|
}
|
||||||
|
@ -293,8 +293,7 @@ func TestCollectionSearch(t *testing.T) {
|
||||||
id := fmt.Sprintf("%04d", j)
|
id := fmt.Sprintf("%04d", j)
|
||||||
ex := fmt.Sprintf("%04d", i)
|
ex := fmt.Sprintf("%04d", i)
|
||||||
c.Set(object.New(id, String(ex),
|
c.Set(object.New(id, String(ex),
|
||||||
0, 0,
|
0, makeFields(
|
||||||
makeFields(
|
|
||||||
field.Make("i", ex),
|
field.Make("i", ex),
|
||||||
field.Make("j", id),
|
field.Make("j", id),
|
||||||
)))
|
)))
|
||||||
|
@ -352,11 +351,11 @@ func TestCollectionSearch(t *testing.T) {
|
||||||
|
|
||||||
func TestCollectionWeight(t *testing.T) {
|
func TestCollectionWeight(t *testing.T) {
|
||||||
c := New()
|
c := New()
|
||||||
c.Set(object.New("1", String("1"), 0, 0, field.List{}))
|
c.Set(object.New("1", String("1"), 0, field.List{}))
|
||||||
expect(t, c.TotalWeight() > 0)
|
expect(t, c.TotalWeight() > 0)
|
||||||
c.Delete("1")
|
c.Delete("1")
|
||||||
expect(t, c.TotalWeight() == 0)
|
expect(t, c.TotalWeight() == 0)
|
||||||
c.Set(object.New("1", String("1"), 0, 0,
|
c.Set(object.New("1", String("1"), 0,
|
||||||
toFields(
|
toFields(
|
||||||
[]string{"a", "b", "c"},
|
[]string{"a", "b", "c"},
|
||||||
[]string{"1", "2", "3"},
|
[]string{"1", "2", "3"},
|
||||||
|
@ -365,19 +364,19 @@ func TestCollectionWeight(t *testing.T) {
|
||||||
expect(t, c.TotalWeight() > 0)
|
expect(t, c.TotalWeight() > 0)
|
||||||
c.Delete("1")
|
c.Delete("1")
|
||||||
expect(t, c.TotalWeight() == 0)
|
expect(t, c.TotalWeight() == 0)
|
||||||
c.Set(object.New("1", String("1"), 0, 0,
|
c.Set(object.New("1", String("1"), 0,
|
||||||
toFields(
|
toFields(
|
||||||
[]string{"a", "b", "c"},
|
[]string{"a", "b", "c"},
|
||||||
[]string{"1", "2", "3"},
|
[]string{"1", "2", "3"},
|
||||||
),
|
),
|
||||||
))
|
))
|
||||||
c.Set(object.New("2", String("2"), 0, 0,
|
c.Set(object.New("2", String("2"), 0,
|
||||||
toFields(
|
toFields(
|
||||||
[]string{"d", "e", "f"},
|
[]string{"d", "e", "f"},
|
||||||
[]string{"4", "5", "6"},
|
[]string{"4", "5", "6"},
|
||||||
),
|
),
|
||||||
))
|
))
|
||||||
c.Set(object.New("1", String("1"), 0, 0,
|
c.Set(object.New("1", String("1"), 0,
|
||||||
toFields(
|
toFields(
|
||||||
[]string{"d", "e", "f"},
|
[]string{"d", "e", "f"},
|
||||||
[]string{"4", "5", "6"},
|
[]string{"4", "5", "6"},
|
||||||
|
@ -417,13 +416,13 @@ func TestSpatialSearch(t *testing.T) {
|
||||||
q4, _ := geojson.Parse(gjson.Get(json, `features.#[id=="q4"]`).Raw, nil)
|
q4, _ := geojson.Parse(gjson.Get(json, `features.#[id=="q4"]`).Raw, nil)
|
||||||
|
|
||||||
c := New()
|
c := New()
|
||||||
c.Set(object.New("p1", p1, 0, 0, field.List{}))
|
c.Set(object.New("p1", p1, 0, field.List{}))
|
||||||
c.Set(object.New("p2", p2, 0, 0, field.List{}))
|
c.Set(object.New("p2", p2, 0, field.List{}))
|
||||||
c.Set(object.New("p3", p3, 0, 0, field.List{}))
|
c.Set(object.New("p3", p3, 0, field.List{}))
|
||||||
c.Set(object.New("p4", p4, 0, 0, field.List{}))
|
c.Set(object.New("p4", p4, 0, field.List{}))
|
||||||
c.Set(object.New("r1", r1, 0, 0, field.List{}))
|
c.Set(object.New("r1", r1, 0, field.List{}))
|
||||||
c.Set(object.New("r2", r2, 0, 0, field.List{}))
|
c.Set(object.New("r2", r2, 0, field.List{}))
|
||||||
c.Set(object.New("r3", r3, 0, 0, field.List{}))
|
c.Set(object.New("r3", r3, 0, field.List{}))
|
||||||
|
|
||||||
var n int
|
var n int
|
||||||
|
|
||||||
|
@ -507,7 +506,7 @@ func TestCollectionSparse(t *testing.T) {
|
||||||
x := (r.Max.X-r.Min.X)*rand.Float64() + r.Min.X
|
x := (r.Max.X-r.Min.X)*rand.Float64() + r.Min.X
|
||||||
y := (r.Max.Y-r.Min.Y)*rand.Float64() + r.Min.Y
|
y := (r.Max.Y-r.Min.Y)*rand.Float64() + r.Min.Y
|
||||||
point := PO(x, y)
|
point := PO(x, y)
|
||||||
c.Set(object.New(fmt.Sprintf("%d", i), point, 0, 0, field.List{}))
|
c.Set(object.New(fmt.Sprintf("%d", i), point, 0, field.List{}))
|
||||||
}
|
}
|
||||||
var n int
|
var n int
|
||||||
n = 0
|
n = 0
|
||||||
|
@ -587,7 +586,7 @@ func TestManyCollections(t *testing.T) {
|
||||||
col = New()
|
col = New()
|
||||||
colsM[key] = col
|
colsM[key] = col
|
||||||
}
|
}
|
||||||
col.Set(object.New(id, obj, 0, 0, field.List{}))
|
col.Set(object.New(id, obj, 0, field.List{}))
|
||||||
k++
|
k++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -641,7 +640,7 @@ func benchmarkInsert(t *testing.B, nFields int) {
|
||||||
col := New()
|
col := New()
|
||||||
t.ResetTimer()
|
t.ResetTimer()
|
||||||
for i := 0; i < t.N; i++ {
|
for i := 0; i < t.N; i++ {
|
||||||
col.Set(object.New(items[i].id, items[i].object, 0, 0, items[i].fields))
|
col.Set(object.New(items[i].id, items[i].object, 0, items[i].fields))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -665,11 +664,11 @@ func benchmarkReplace(t *testing.B, nFields int) {
|
||||||
}
|
}
|
||||||
col := New()
|
col := New()
|
||||||
for i := 0; i < t.N; i++ {
|
for i := 0; i < t.N; i++ {
|
||||||
col.Set(object.New(items[i].id, items[i].object, 0, 0, items[i].fields))
|
col.Set(object.New(items[i].id, items[i].object, 0, items[i].fields))
|
||||||
}
|
}
|
||||||
t.ResetTimer()
|
t.ResetTimer()
|
||||||
for _, i := range rand.Perm(t.N) {
|
for _, i := range rand.Perm(t.N) {
|
||||||
o := col.Set(object.New(items[i].id, items[i].object, 0, 0, field.List{}))
|
o := col.Set(object.New(items[i].id, items[i].object, 0, field.List{}))
|
||||||
if o.Geo() != items[i].object {
|
if o.Geo() != items[i].object {
|
||||||
t.Fatal("shoot!")
|
t.Fatal("shoot!")
|
||||||
}
|
}
|
||||||
|
@ -696,7 +695,7 @@ func benchmarkGet(t *testing.B, nFields int) {
|
||||||
}
|
}
|
||||||
col := New()
|
col := New()
|
||||||
for i := 0; i < t.N; i++ {
|
for i := 0; i < t.N; i++ {
|
||||||
col.Set(object.New(items[i].id, items[i].object, 0, 0, items[i].fields))
|
col.Set(object.New(items[i].id, items[i].object, 0, items[i].fields))
|
||||||
}
|
}
|
||||||
t.ResetTimer()
|
t.ResetTimer()
|
||||||
for _, i := range rand.Perm(t.N) {
|
for _, i := range rand.Perm(t.N) {
|
||||||
|
@ -727,7 +726,7 @@ func benchmarkRemove(t *testing.B, nFields int) {
|
||||||
}
|
}
|
||||||
col := New()
|
col := New()
|
||||||
for i := 0; i < t.N; i++ {
|
for i := 0; i < t.N; i++ {
|
||||||
col.Set(object.New(items[i].id, items[i].object, 0, 0, items[i].fields))
|
col.Set(object.New(items[i].id, items[i].object, 0, items[i].fields))
|
||||||
}
|
}
|
||||||
t.ResetTimer()
|
t.ResetTimer()
|
||||||
for _, i := range rand.Perm(t.N) {
|
for _, i := range rand.Perm(t.N) {
|
||||||
|
@ -758,7 +757,7 @@ func benchmarkScan(t *testing.B, nFields int) {
|
||||||
}
|
}
|
||||||
col := New()
|
col := New()
|
||||||
for i := 0; i < t.N; i++ {
|
for i := 0; i < t.N; i++ {
|
||||||
col.Set(object.New(items[i].id, items[i].object, 0, 0, items[i].fields))
|
col.Set(object.New(items[i].id, items[i].object, 0, items[i].fields))
|
||||||
}
|
}
|
||||||
t.ResetTimer()
|
t.ResetTimer()
|
||||||
for i := 0; i < t.N; i++ {
|
for i := 0; i < t.N; i++ {
|
||||||
|
|
|
@ -9,7 +9,6 @@ import (
|
||||||
type Object struct {
|
type Object struct {
|
||||||
id string
|
id string
|
||||||
geo geojson.Object
|
geo geojson.Object
|
||||||
created int64 // unix nano created
|
|
||||||
expires int64 // unix nano expiration
|
expires int64 // unix nano expiration
|
||||||
fields field.List
|
fields field.List
|
||||||
}
|
}
|
||||||
|
@ -28,13 +27,6 @@ func (o *Object) Fields() field.List {
|
||||||
return o.fields
|
return o.fields
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *Object) Created() int64 {
|
|
||||||
if o == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
return o.created
|
|
||||||
}
|
|
||||||
|
|
||||||
func (o *Object) Expires() int64 {
|
func (o *Object) Expires() int64 {
|
||||||
if o == nil {
|
if o == nil {
|
||||||
return 0
|
return 0
|
||||||
|
@ -83,13 +75,11 @@ func (o *Object) Weight() int {
|
||||||
return weight
|
return weight
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(id string, geo geojson.Object, created, expires int64,
|
func New(id string, geo geojson.Object, expires int64, fields field.List,
|
||||||
fields field.List,
|
|
||||||
) *Object {
|
) *Object {
|
||||||
return &Object{
|
return &Object{
|
||||||
id: id,
|
id: id,
|
||||||
geo: geo,
|
geo: geo,
|
||||||
created: created,
|
|
||||||
expires: expires,
|
expires: expires,
|
||||||
fields: fields,
|
fields: fields,
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,6 @@ func P(x, y float64) geojson.Object {
|
||||||
return geojson.NewSimplePoint(geometry.Point{X: 10, Y: 20})
|
return geojson.NewSimplePoint(geometry.Point{X: 10, Y: 20})
|
||||||
}
|
}
|
||||||
func TestObject(t *testing.T) {
|
func TestObject(t *testing.T) {
|
||||||
o := New("hello", P(10, 20), 0, 99, field.List{})
|
o := New("hello", P(10, 20), 99, field.List{})
|
||||||
assert.Assert(o.ID() == "hello")
|
assert.Assert(o.ID() == "hello")
|
||||||
}
|
}
|
||||||
|
|
|
@ -721,7 +721,7 @@ func (s *Server) cmdSET(msg *Message) (resp.Value, commandDetails, error) {
|
||||||
ofields = ofields.Set(f)
|
ofields = ofields.Set(f)
|
||||||
}
|
}
|
||||||
|
|
||||||
obj := object.New(id, oobj, 0, ex, ofields)
|
obj := object.New(id, oobj, ex, ofields)
|
||||||
old := col.Set(obj)
|
old := col.Set(obj)
|
||||||
|
|
||||||
// >> Response
|
// >> Response
|
||||||
|
@ -815,7 +815,7 @@ func (s *Server) cmdFSET(msg *Message) (resp.Value, commandDetails, error) {
|
||||||
updateCount++
|
updateCount++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
obj := object.New(id, o.Geo(), 0, o.Expires(), ofields)
|
obj := object.New(id, o.Geo(), o.Expires(), ofields)
|
||||||
col.Set(obj)
|
col.Set(obj)
|
||||||
d.command = "fset"
|
d.command = "fset"
|
||||||
d.key = key
|
d.key = key
|
||||||
|
@ -860,7 +860,7 @@ func (s *Server) cmdEXPIRE(msg *Message) (resp.Value, commandDetails, error) {
|
||||||
o := col.Get(id)
|
o := col.Get(id)
|
||||||
ok = o != nil
|
ok = o != nil
|
||||||
if ok {
|
if ok {
|
||||||
obj = object.New(id, o.Geo(), 0, ex, o.Fields())
|
obj = object.New(id, o.Geo(), ex, o.Fields())
|
||||||
col.Set(obj)
|
col.Set(obj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -919,7 +919,7 @@ func (s *Server) cmdPERSIST(msg *Message) (resp.Value, commandDetails, error) {
|
||||||
var obj *object.Object
|
var obj *object.Object
|
||||||
var cleared bool
|
var cleared bool
|
||||||
if o.Expires() != 0 {
|
if o.Expires() != 0 {
|
||||||
obj = object.New(id, o.Geo(), 0, 0, o.Fields())
|
obj = object.New(id, o.Geo(), 0, o.Fields())
|
||||||
col.Set(obj)
|
col.Set(obj)
|
||||||
cleared = true
|
cleared = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,7 @@ func fenceMatch(
|
||||||
fence.cmd = "intersects"
|
fence.cmd = "intersects"
|
||||||
temp = true
|
temp = true
|
||||||
}
|
}
|
||||||
lso := object.New("", ls, 0, 0, field.List{})
|
lso := object.New("", ls, 0, field.List{})
|
||||||
if fenceMatchObject(fence, lso) {
|
if fenceMatchObject(fence, lso) {
|
||||||
detect = "cross"
|
detect = "cross"
|
||||||
}
|
}
|
||||||
|
|
|
@ -300,7 +300,7 @@ func (s *Server) cmdJset(msg *Message) (res resp.Value, d commandDetails, err er
|
||||||
s.cols.Set(key, col)
|
s.cols.Set(key, col)
|
||||||
}
|
}
|
||||||
var oobj geojson.Object = collection.String(json)
|
var oobj geojson.Object = collection.String(json)
|
||||||
obj := object.New(id, oobj, 0, 0, fields)
|
obj := object.New(id, oobj, 0, fields)
|
||||||
col.Set(obj)
|
col.Set(obj)
|
||||||
|
|
||||||
d.key = key
|
d.key = key
|
||||||
|
@ -369,7 +369,7 @@ func (s *Server) cmdJdel(msg *Message) (res resp.Value, d commandDetails, err er
|
||||||
}
|
}
|
||||||
|
|
||||||
var oobj geojson.Object = collection.String(json)
|
var oobj geojson.Object = collection.String(json)
|
||||||
obj := object.New(id, oobj, 0, 0, fields)
|
obj := object.New(id, oobj, 0, fields)
|
||||||
col.Set(obj)
|
col.Set(obj)
|
||||||
|
|
||||||
d.key = key
|
d.key = key
|
||||||
|
|
|
@ -307,7 +307,7 @@ func (sw *scanWriter) pushObject(opts ScanWriterParams) (keepGoing bool, err err
|
||||||
opts.obj = object.New(
|
opts.obj = object.New(
|
||||||
opts.obj.ID(),
|
opts.obj.ID(),
|
||||||
clip.Clip(opts.obj.Geo(), opts.clip, &sw.s.geomIndexOpts),
|
clip.Clip(opts.obj.Geo(), opts.clip, &sw.s.geomIndexOpts),
|
||||||
0, opts.obj.Expires(),
|
opts.obj.Expires(),
|
||||||
opts.obj.Fields(),
|
opts.obj.Fields(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ func BenchmarkFieldMatch(t *testing.B) {
|
||||||
for i := 0; i < t.N; i++ {
|
for i := 0; i < t.N; i++ {
|
||||||
// one call is super fast, measurements are not reliable, let's do 100
|
// one call is super fast, measurements are not reliable, let's do 100
|
||||||
for ix := 0; ix < 100; ix++ {
|
for ix := 0; ix < 100; ix++ {
|
||||||
sw.fieldMatch(object.New("", items[i].object, 0, 0, items[i].fields))
|
sw.fieldMatch(object.New("", items[i].object, 0, items[i].fields))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue