Help us shape the future of Go! Take the 2026 Go Developer Survey

tag

package
v0.31.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package tag provides application logic for tag objects.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNameMissing = errors.New("tag name must not be blank")
)

Functions

func ByAlias added in v0.8.0

func ByAlias(ctx context.Context, qb models.TagNameFinder, alias string) (*models.Tag, error)

func ByName added in v0.8.0

func ByName(ctx context.Context, qb models.TagNameFinder, name string) (*models.Tag, error)

func EnsureAliasesUnique added in v0.8.0

func EnsureAliasesUnique(ctx context.Context, id int, aliases []string, qb models.TagNameFinder) error

func EnsureTagNameUnique added in v0.8.0

func EnsureTagNameUnique(ctx context.Context, id int, name string, qb models.TagNameFinder) error

EnsureTagNameUnique returns an error if the tag name provided is used as a name or alias of another existing tag.

func GetDependentTagIDs added in v0.29.0

func GetDependentTagIDs(ctx context.Context, reader FinderAliasImageGetter, tag *models.Tag) ([]int, error)

GetDependentTagIDs returns a slice of unique tag IDs that this tag references.

func GetIDs

func GetIDs(tags []*models.Tag) []int

func GetNames

func GetNames(tags []*models.Tag) []string

func ToJSON

func ToJSON(ctx context.Context, reader FinderAliasImageGetter, tag *models.Tag) (*jsonschema.Tag, error)

ToJSON converts a Tag object into its JSON equivalent.

func ValidateCreate added in v0.27.0

func ValidateCreate(ctx context.Context, tag models.Tag, qb models.TagReader) error

func ValidateHierarchyExisting added in v0.27.0

func ValidateHierarchyExisting(ctx context.Context, tag *models.Tag, parentIDs, childIDs []int, qb RelationshipFinder) error

func ValidateHierarchyNew added in v0.27.0

func ValidateHierarchyNew(ctx context.Context, parentIDs, childIDs []int, qb RelationshipFinder) error

func ValidateUpdate added in v0.27.0

func ValidateUpdate(ctx context.Context, id int, partial models.TagPartial, qb models.TagReader) error

Types

type FinderAliasImageGetter added in v0.17.0

type FinderAliasImageGetter interface {
	GetAliases(ctx context.Context, studioID int) ([]string, error)
	GetImage(ctx context.Context, tagID int) ([]byte, error)
	FindByChildTagID(ctx context.Context, childID int) ([]*models.Tag, error)
	GetCustomFields(ctx context.Context, id int) (map[string]interface{}, error)
	models.StashIDLoader
}

type Importer

type Importer struct {
	ReaderWriter        ImporterReaderWriter
	Input               jsonschema.Tag
	MissingRefBehaviour models.ImportMissingRefEnum
	// contains filtered or unexported fields
}

func (*Importer) Create

func (i *Importer) Create(ctx context.Context) (*int, error)

func (*Importer) FindExistingID

func (i *Importer) FindExistingID(ctx context.Context) (*int, error)

func (*Importer) Name

func (i *Importer) Name() string

func (*Importer) PostImport

func (i *Importer) PostImport(ctx context.Context, id int) error

func (*Importer) PreImport

func (i *Importer) PreImport(ctx context.Context) error

func (*Importer) Update

func (i *Importer) Update(ctx context.Context, id int) error

type ImporterReaderWriter added in v0.23.0

type ImporterReaderWriter interface {
	models.TagCreatorUpdater
	FindByName(ctx context.Context, name string, nocase bool) (*models.Tag, error)
}

type InvalidTagHierarchyError added in v0.10.0

type InvalidTagHierarchyError struct {
	Direction       string
	CurrentRelation string
	InvalidTag      string
	ApplyingTag     string
	TagPath         string
}

func (*InvalidTagHierarchyError) Error added in v0.10.0

func (e *InvalidTagHierarchyError) Error() string

type NameExistsError added in v0.8.0

type NameExistsError struct {
	Name string
}

func (*NameExistsError) Error added in v0.8.0

func (e *NameExistsError) Error() string

type NameUsedByAliasError added in v0.8.0

type NameUsedByAliasError struct {
	Name     string
	OtherTag string
}

func (*NameUsedByAliasError) Error added in v0.8.0

func (e *NameUsedByAliasError) Error() string

type NotFoundError added in v0.27.0

type NotFoundError struct {
	// contains filtered or unexported fields
}

func (*NotFoundError) Error added in v0.27.0

func (e *NotFoundError) Error() string

type ParentTagNotExistError added in v0.10.0

type ParentTagNotExistError struct {
	// contains filtered or unexported fields
}

func (ParentTagNotExistError) Error added in v0.10.0

func (e ParentTagNotExistError) Error() string

func (ParentTagNotExistError) MissingParent added in v0.10.0

func (e ParentTagNotExistError) MissingParent() string

type RelationshipFinder added in v0.23.0

type RelationshipFinder interface {
	FindAllAncestors(ctx context.Context, tagID int, excludeIDs []int) ([]*models.TagPath, error)
	FindAllDescendants(ctx context.Context, tagID int, excludeIDs []int) ([]*models.TagPath, error)
	models.TagRelationLoader
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL