func EnsureTagNameUnique(id int, name string, qb models.TagReader) error {
	// ensure name is unique
	sameNameTag, err := ByName(qb, name)
	if err != nil {
		return err
	}

	if sameNameTag != nil && id != sameNameTag.ID {
		return &NameExistsError{
			Name: name,
		}
	}

	// query by alias
	sameNameTag, err = ByAlias(qb, name)
	if err != nil {
		return err
	}

	if sameNameTag != nil && id != sameNameTag.ID {
		return &NameUsedByAliasError{
			Name:     name,
			OtherTag: sameNameTag.Name,
		}
	}

	return nil
}
// EnsureTagNameUnique returns an error if the tag name provided
// is used as a name or alias of another existing tag.
EnsureTagNameUnique returns an error if the tag name provided
is used as a name or alias of another existing tag.
// EnsureTagNameUnique returns an error if the tag name provided // is used as a name or alias of another existing tag .
func EnsureTagNameUnique(id int, name string, qb models.TagReader) error {
	sameNameTag, err := ByName(qb, name)
	if err != nil {
		return err
	}
	if sameNameTag != nil && id != sameNameTag.ID {
		return &NameExistsError{
			Name: name,
		}
	}
	sameNameTag, err = ByAlias(qb, name)
	if err != nil {
		return err
	}
	if sameNameTag != nil && id != sameNameTag.ID {
		return &NameUsedByAliasError{
			Name:     name,
			OtherTag: sameNameTag.Name,
		}
	}
	return nil
}
func EnsureTagNameUnique ( id int , name string , qb models . TagReader ) error { sameNameTag , err := ByName ( qb , name ) if err != nil { return err } if sameNameTag != nil && id != sameNameTag . ID { return & NameExistsError { Name : name , } } sameNameTag , err = ByAlias ( qb , name ) if err != nil { return err } if sameNameTag != nil && id != sameNameTag . ID { return & NameUsedByAliasError { Name : name , OtherTag : sameNameTag . Name , } } return nil }
EnsureTagNameUnique returns an error if the tag name provided
is used as a name or alias of another existing tag.
EnsureTagNameUnique returns an error if the tag name provided is used as a name or alias of another existing tag .
// ensure name is unique // query by alias