// Adds a tag. func (storage *Storage) AddTag(tx *Tx, name string) (*entities.Tag, error) { if err := entities.ValidateTagName(name); err != nil { return nil, err } return database.InsertTag(tx.tx, name) }
// Copies a tag. func (storage Storage) CopyTag(tx *Tx, sourceTagId entities.TagId, name string) (*entities.Tag, error) { if err := entities.ValidateTagName(name); err != nil { return nil, err } tag, err := database.InsertTag(tx.tx, name) if err != nil { return nil, err } err = database.CopyFileTags(tx.tx, sourceTagId, tag.Id) if err != nil { return nil, err } return tag, nil }