Storage to uuids
This commit is contained in:
@@ -289,7 +289,7 @@ func applyUnset(doc, operator bson.M) (bson.M, error) {
|
||||
ok = pmok
|
||||
}
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("subpath cannot be followed for non object: %s (%s): %+v (%T)", k, nesting[0], mInterface, mInterface)
|
||||
return nil, fmt.Errorf("subpath of %v (%v) cannot be followed for non object: %s (%s): %+v (%T)", doc, doc[nesting[0]], k, nesting[0], mInterface, mInterface)
|
||||
}
|
||||
subdoc, err := applyUnset(bson.M(m), bson.M{strings.Join(nesting[1:], "."): ""})
|
||||
if err != nil {
|
||||
@@ -322,7 +322,7 @@ func applySet(doc, operator bson.M) (bson.M, error) {
|
||||
ok = pmok
|
||||
}
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("subpath cannot be followed for non object: %s (%s): %+v (%T)", k, nesting[0], mInterface, mInterface)
|
||||
return nil, fmt.Errorf("subpath of %v (%v) cannot be followed for non object: %s (%s): %+v (%T)", doc, doc[nesting[0]], k, nesting[0], mInterface, mInterface)
|
||||
}
|
||||
subdoc, err := applySet(bson.M(m), bson.M{strings.Join(nesting[1:], "."): v})
|
||||
if err != nil {
|
||||
|
||||
@@ -143,9 +143,6 @@ func TestBoltDBFind(t *testing.T) {
|
||||
if o.Text == "" {
|
||||
t.Error(o.Text)
|
||||
}
|
||||
if o.Relationship != "" {
|
||||
t.Error(o.Relationship)
|
||||
}
|
||||
if o.Modified == 0 {
|
||||
t.Error(o.Modified)
|
||||
}
|
||||
@@ -156,18 +153,9 @@ func TestBoltDBFind(t *testing.T) {
|
||||
t.Error(o.Connections)
|
||||
}
|
||||
for k := range o.Connections {
|
||||
if o.Connections[k].Name == "" {
|
||||
t.Error(o.Connections[k])
|
||||
}
|
||||
if o.Connections[k].Title == "" {
|
||||
t.Error(o.Connections[k])
|
||||
}
|
||||
if o.Connections[k].Relationship == "" {
|
||||
t.Error(o.Connections[k])
|
||||
}
|
||||
if o.Connections[k].Type == "" {
|
||||
t.Error(o.Connections[k])
|
||||
}
|
||||
}
|
||||
}
|
||||
if n != testN {
|
||||
@@ -317,13 +305,6 @@ func TestBoltDBInsert(t *testing.T) {
|
||||
if _, ok := ones[0].Connections[k]; !ok {
|
||||
t.Fatalf("db had more connections than real: %s", k)
|
||||
}
|
||||
c := o.Connections[k]
|
||||
c.Modified = 0
|
||||
o.Connections[k] = c
|
||||
|
||||
c = ones[0].Connections[k]
|
||||
c.Modified = 0
|
||||
ones[0].Connections[k] = c
|
||||
}
|
||||
o.Modified = 0
|
||||
ones[0].Modified = 0
|
||||
@@ -372,7 +353,7 @@ func TestBoltDBDelete(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if n != wantN {
|
||||
t.Error(n, filter)
|
||||
t.Error(wantN, n, filter)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -401,11 +382,10 @@ func fillBoltDB(t *testing.T, bdb *BoltDB) {
|
||||
}
|
||||
for i := 0; i < testN; i++ {
|
||||
p := entity.One{
|
||||
ID: "iddd-" + uuid.New().String()[:5],
|
||||
Name: "name-" + uuid.New().String()[:5],
|
||||
Type: "type-" + uuid.New().String()[:5],
|
||||
Relationship: "rshp-" + uuid.New().String()[:5],
|
||||
Title: "titl-" + uuid.New().String()[:5],
|
||||
ID: "iddd-" + uuid.New().String()[:5],
|
||||
Name: "name-" + uuid.New().String()[:5],
|
||||
Type: "type-" + uuid.New().String()[:5],
|
||||
Title: "titl-" + uuid.New().String()[:5],
|
||||
}
|
||||
o := entity.One{
|
||||
ID: "iddd-" + uuid.New().String()[:5],
|
||||
@@ -414,8 +394,8 @@ func fillBoltDB(t *testing.T, bdb *BoltDB) {
|
||||
Title: "titl-" + uuid.New().String()[:5],
|
||||
Text: "text-" + uuid.New().String()[:5],
|
||||
Modified: time.Now().UnixNano(),
|
||||
Connections: map[string]entity.One{p.ID: p},
|
||||
Attachments: map[string]string{"filename": "/path/to/file"},
|
||||
Connections: map[string]entity.Connection{p.ID: entity.Connection{p.Name}},
|
||||
Attachments: map[string]entity.Attachment{"filename": {"/path/to/file"}},
|
||||
}
|
||||
b, err := bson.Marshal(o)
|
||||
if err != nil {
|
||||
|
||||
@@ -14,11 +14,10 @@ func tempMap(t *testing.T) *Map {
|
||||
mp.db[testNS] = map[string][]byte{}
|
||||
for i := 0; i < testN; i++ {
|
||||
p := entity.One{
|
||||
ID: "iddd-" + uuid.New().String()[:5],
|
||||
Name: "name-" + uuid.New().String()[:5],
|
||||
Type: "type-" + uuid.New().String()[:5],
|
||||
Relationship: "rshp-" + uuid.New().String()[:5],
|
||||
Title: "titl-" + uuid.New().String()[:5],
|
||||
ID: "iddd-" + uuid.New().String()[:5],
|
||||
Name: "name-" + uuid.New().String()[:5],
|
||||
Type: "type-" + uuid.New().String()[:5],
|
||||
Title: "titl-" + uuid.New().String()[:5],
|
||||
}
|
||||
o := entity.One{
|
||||
ID: "iddd-" + uuid.New().String()[:5],
|
||||
@@ -27,8 +26,8 @@ func tempMap(t *testing.T) *Map {
|
||||
Title: "titl-" + uuid.New().String()[:5],
|
||||
Text: "text-" + uuid.New().String()[:5],
|
||||
Modified: time.Now().UnixNano(),
|
||||
Connections: map[string]entity.One{p.ID: p},
|
||||
Attachments: map[string]string{"filename": "/path/to/file"},
|
||||
Connections: map[string]entity.Connection{p.ID: entity.Connection{p.Name}},
|
||||
Attachments: map[string]entity.Attachment{"filename": {"/path/to/file"}},
|
||||
}
|
||||
b, err := bson.Marshal(o)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user