func (m *PluginManager) Create(raw *plugin.Plugin) (*plugin.Plugin, error) { // TODO (m0sth8): add validattion 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 }
func (m *PluginManager) Update(obj *plugin.Plugin) error { obj.Updated = time.Now().UTC() return m.col.UpdateId(obj.Id, obj) }