Documentation
¶
Index ¶
- Variables
- func ByAlias(ctx context.Context, qb models.StudioQueryer, alias string) (*models.Studio, error)
- func ByName(ctx context.Context, qb models.StudioQueryer, name string) (*models.Studio, error)
- func EnsureAliasesUnique(ctx context.Context, id int, aliases []string, qb models.StudioQueryer) error
- func EnsureStudioNameUnique(ctx context.Context, id int, name string, qb models.StudioQueryer) error
- func ToJSON(ctx context.Context, reader FinderImageStashIDGetter, studio *models.Studio) (*jsonschema.Studio, error)
- func ValidateCreate(ctx context.Context, studio models.Studio, qb models.StudioQueryer) error
- func ValidateModify(ctx context.Context, s models.StudioPartial, qb ValidateModifyReader) error
- type FinderImageStashIDGetter
- type Importer
- func (i *Importer) Create(ctx context.Context) (*int, error)
- func (i *Importer) FindExistingID(ctx context.Context) (*int, error)
- func (i *Importer) Name() string
- func (i *Importer) PostImport(ctx context.Context, id int) error
- func (i *Importer) PreImport(ctx context.Context) error
- func (i *Importer) Update(ctx context.Context, id int) error
- type ImporterReaderWriter
- type NameExistsError
- type NameUsedByAliasError
- type ValidateModifyReader
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNameMissing = errors.New("studio name must not be blank")
ErrStudioOwnAncestor = errors.New("studio cannot be an ancestor of itself")
)
View Source
var ErrParentStudioNotExist = errors.New("parent studio does not exist")
Functions ¶
func ByAlias ¶ added in v0.10.0
func ByAlias(ctx context.Context, qb models.StudioQueryer, alias string) (*models.Studio, error)
func ByName ¶ added in v0.10.0
func ByName(ctx context.Context, qb models.StudioQueryer, name string) (*models.Studio, error)
func EnsureAliasesUnique ¶ added in v0.10.0
func EnsureAliasesUnique(ctx context.Context, id int, aliases []string, qb models.StudioQueryer) error
func EnsureStudioNameUnique ¶ added in v0.10.0
func EnsureStudioNameUnique(ctx context.Context, id int, name string, qb models.StudioQueryer) error
EnsureStudioNameUnique returns an error if the studio name provided is used as a name or alias of another existing tag.
func ToJSON ¶
func ToJSON(ctx context.Context, reader FinderImageStashIDGetter, studio *models.Studio) (*jsonschema.Studio, error)
ToJSON converts a Studio object into its JSON equivalent.
func ValidateCreate ¶ added in v0.24.3
func ValidateCreate(ctx context.Context, studio models.Studio, qb models.StudioQueryer) error
func ValidateModify ¶ added in v0.22.0
func ValidateModify(ctx context.Context, s models.StudioPartial, qb ValidateModifyReader) error
Checks to make sure that: 1. The studio exists locally 2. The studio is not its own ancestor 3. The studio's aliases are unique 4. The name is unique
Types ¶
type FinderImageStashIDGetter ¶ added in v0.17.0
type FinderImageStashIDGetter interface {
models.StudioGetter
models.AliasLoader
models.StashIDLoader
GetImage(ctx context.Context, studioID int) ([]byte, error)
}
type Importer ¶
type Importer struct {
ReaderWriter ImporterReaderWriter
Input jsonschema.Studio
MissingRefBehaviour models.ImportMissingRefEnum
ID int
// contains filtered or unexported fields
}
func (*Importer) FindExistingID ¶
func (i *Importer) FindExistingID(ctx context.Context) (*int, error)
func (*Importer) PostImport ¶
func (i *Importer) PostImport(ctx context.Context, id int) error
type ImporterReaderWriter ¶ added in v0.23.0
type ImporterReaderWriter interface {
models.StudioCreatorUpdater
FindByName(ctx context.Context, name string, nocase bool) (*models.Studio, error)
}
type NameExistsError ¶ added in v0.10.0
type NameExistsError struct {
Name string
}
type NameUsedByAliasError ¶ added in v0.10.0
type NameUsedByAliasError struct {
Name string
OtherStudio string
}
type ValidateModifyReader ¶ added in v0.23.0
type ValidateModifyReader interface {
models.StudioGetter
models.StudioQueryer
models.AliasLoader
}
Click to show internal directories.
Click to hide internal directories.