Add attachments field to one
This commit is contained in:
@@ -18,17 +18,19 @@ const (
|
||||
Text = "text"
|
||||
Modified = "modified"
|
||||
Connections = "connections"
|
||||
Attachments = "attachments"
|
||||
)
|
||||
|
||||
type One struct {
|
||||
Name string `bson:"_id,omitempty" json:"name,omitempty"`
|
||||
Type string `bson:"type,omitempty" json:"type,omitempty"`
|
||||
Title string `bson:"title,omitempty" json:"title,omitempty"`
|
||||
Image string `bson:"image,omitempty" json:"image,omitempty"`
|
||||
Text string `bson:"text,omitempty" json:"text,omitempty"`
|
||||
Relationship string `bson:"relationship,omitempty" json:"relationship,omitempty"`
|
||||
Modified int64 `bson:"modified,omitempty" json:"modified,omitempty"`
|
||||
Connections map[string]One `bson:"connections,omitempty" json:"connections,omitempty"`
|
||||
Name string `bson:"_id,omitempty" json:"name,omitempty"`
|
||||
Type string `bson:"type,omitempty" json:"type,omitempty"`
|
||||
Title string `bson:"title,omitempty" json:"title,omitempty"`
|
||||
Image string `bson:"image,omitempty" json:"image,omitempty"`
|
||||
Text string `bson:"text,omitempty" json:"text,omitempty"`
|
||||
Relationship string `bson:"relationship,omitempty" json:"relationship,omitempty"`
|
||||
Modified int64 `bson:"modified,omitempty" json:"modified,omitempty"`
|
||||
Connections map[string]One `bson:"connections,omitempty" json:"connections,omitempty"`
|
||||
Attachments map[string]string `bson:"attachments,omitempty" json:"attachments,omitempty"`
|
||||
}
|
||||
|
||||
func (o One) Query() One {
|
||||
|
||||
@@ -28,10 +28,13 @@ func TestOneMarshalBSON(t *testing.T) {
|
||||
one: (One{Name: "hello", Type: "world", Modified: 1}).Query(),
|
||||
},
|
||||
"modified changes": {
|
||||
one: (One{Name: "hello", Type: "world", Modified: 1}),
|
||||
one: One{Name: "hello", Type: "world", Modified: 1},
|
||||
},
|
||||
"w/ connections": {
|
||||
one: (One{Name: "hello", Type: "world", Modified: 1, Connections: map[string]One{"hi": One{Name: "hi", Relationship: "mom"}}}),
|
||||
one: One{Name: "hello", Type: "world", Modified: 1, Connections: map[string]One{"hi": One{Name: "hi", Relationship: "mom"}}},
|
||||
},
|
||||
"w/ attachments": {
|
||||
one: One{Name: "hello", Type: "world", Modified: 1, Attachments: map[string]string{"hello": "/world"}},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user