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

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

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

	if sameNameStudio != nil && id != sameNameStudio.ID {
		return &NameUsedByAliasError{
			Name:        name,
			OtherStudio: sameNameStudio.Name.String,
		}
	}

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