コード例 #1
0
ファイル: tag.go プロジェクト: logtcn/TMSU
// 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
}
コード例 #2
0
ファイル: filetag.go プロジェクト: peer23peer/TMSU
// Copies file tags from one tag to another.
func (storage *Storage) CopyFileTags(tx *Tx, sourceTagId, destTagId entities.TagId) error {
	return database.CopyFileTags(tx.tx, sourceTagId, destTagId)
}