|
|
@ -19,6 +19,7 @@ type Change struct { |
|
|
|
Stories []Story `bson:"stories"` |
|
|
|
Tags []Tag `bson:"tags"` |
|
|
|
Chapters []Chapter `bson:"chapters"` |
|
|
|
Comments []Comment `bson:"comments"` |
|
|
|
} |
|
|
|
|
|
|
|
// ChangeKey is a key for a change that can be used when subscribing to them.
|
|
|
@ -29,7 +30,7 @@ type ChangeKey struct { |
|
|
|
|
|
|
|
// Objects makes a combined, mixed array of all the models stored in this change.
|
|
|
|
func (change *Change) Objects() []interface{} { |
|
|
|
data := make([]interface{}, 0, len(change.Logs)+len(change.Characters)+len(change.Channels)+len(change.Posts)+len(change.Stories)+len(change.Tags)+len(change.Chapters)) |
|
|
|
data := make([]interface{}, 0, len(change.Logs)+len(change.Characters)+len(change.Channels)+len(change.Posts)+len(change.Stories)+len(change.Tags)+len(change.Chapters)+len(change.Comments)) |
|
|
|
|
|
|
|
for _, log := range change.Logs { |
|
|
|
data = append(data, log) |
|
|
@ -52,6 +53,9 @@ func (change *Change) Objects() []interface{} { |
|
|
|
for _, chapter := range change.Chapters { |
|
|
|
data = append(data, chapter) |
|
|
|
} |
|
|
|
for _, comment := range change.Comments { |
|
|
|
data = append(data, comment) |
|
|
|
} |
|
|
|
|
|
|
|
return data |
|
|
|
} |