Support primary key ID and unique key Name where api uses name
This commit is contained in:
@@ -14,25 +14,27 @@ 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],
|
||||
}
|
||||
o := entity.One{
|
||||
ID: "iddd-" + uuid.New().String()[:5],
|
||||
Name: "name-" + uuid.New().String()[:5],
|
||||
Type: "type-" + uuid.New().String()[:5],
|
||||
Title: "titl-" + uuid.New().String()[:5],
|
||||
Text: "text-" + uuid.New().String()[:5],
|
||||
Modified: time.Now().UnixNano(),
|
||||
Connections: map[string]entity.One{p.Name: p},
|
||||
Connections: map[string]entity.One{p.ID: p},
|
||||
Attachments: map[string]string{"filename": "/path/to/file"},
|
||||
}
|
||||
b, err := bson.Marshal(o)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
mp.db[testNS][o.Name] = b
|
||||
mp.db[testNS][o.ID] = b
|
||||
}
|
||||
return mp
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user