Example #1
0
func (m *FeedManager) Create(raw *feed.FeedItem) (*feed.FeedItem, error) {
	// TODO (m0sth8): add validation
	raw.Id = bson.NewObjectId()
	raw.Created = time.Now().UTC()
	raw.Updated = raw.Created
	if err := m.col.Insert(raw); err != nil {
		return nil, err
	}
	return raw, nil
}
Example #2
0
func (m *FeedManager) Update(obj *feed.FeedItem) error {
	obj.Updated = time.Now().UTC()
	return m.col.UpdateId(obj.Id, obj)
}