Documentation
¶
Index ¶
- func AddPerformer(ctx context.Context, qb PartialUpdater, o *models.Gallery, performerID int) error
- func AddTag(ctx context.Context, qb PartialUpdater, o *models.Gallery, tagID int) error
- func CountByPerformerID(ctx context.Context, r CountQueryer, id int) (int, error)
- func CountByStudioID(ctx context.Context, r CountQueryer, id int) (int, error)
- func CountByTagID(ctx context.Context, r CountQueryer, id int) (int, error)
- func GetIDs(galleries []*models.Gallery) []int
- func GetRefs(galleries []*models.Gallery) []jsonschema.GalleryRef
- func GetStudioName(ctx context.Context, reader studio.Finder, gallery *models.Gallery) (string, error)
- func PathsFilter(paths []string) *models.GalleryFilterType
- func ToBasicJSON(gallery *models.Gallery) (*jsonschema.Gallery, error)
- type ContentsChangedError
- type CountQueryer
- type Finder
- type FinderByFile
- type FinderCreatorUpdater
- type FullCreatorUpdater
- type ImageFinder
- type ImageFinderUpdater
- type ImageService
- type ImageUpdater
- 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 PartialUpdater
- type Queryer
- type Repository
- type ScanHandler
- type SceneFinderUpdater
- type Service
- func (s *Service) AddImages(ctx context.Context, g *models.Gallery, toAdd ...int) error
- func (s *Service) Destroy(ctx context.Context, i *models.Gallery, fileDeleter *image.FileDeleter, ...) ([]*models.Image, error)
- func (s *Service) RemoveImages(ctx context.Context, g *models.Gallery, toRemove ...int) error
- func (s *Service) ValidateImageGalleryChange(ctx context.Context, i *models.Image, updateIDs models.UpdateIDs) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddPerformer ¶ added in v0.7.0
func AddPerformer(ctx context.Context, qb PartialUpdater, o *models.Gallery, performerID int) error
func AddTag ¶ added in v0.7.0
func AddTag(ctx context.Context, qb PartialUpdater, o *models.Gallery, tagID int) error
func CountByPerformerID ¶ added in v0.7.0
func CountByPerformerID(ctx context.Context, r CountQueryer, id int) (int, error)
func CountByStudioID ¶ added in v0.7.0
func CountByStudioID(ctx context.Context, r CountQueryer, id int) (int, error)
func CountByTagID ¶ added in v0.7.0
func CountByTagID(ctx context.Context, r CountQueryer, id int) (int, error)
func GetStudioName ¶
func GetStudioName(ctx context.Context, reader studio.Finder, gallery *models.Gallery) (string, error)
GetStudioName returns the name of the provided gallery's studio. It returns an empty string if there is no studio assigned to the gallery.
func PathsFilter ¶ added in v0.12.0
func PathsFilter(paths []string) *models.GalleryFilterType
func ToBasicJSON ¶
func ToBasicJSON(gallery *models.Gallery) (*jsonschema.Gallery, error)
ToBasicJSON converts a gallery object into its JSON object equivalent. It does not convert the relationships to other objects.
Types ¶
type ContentsChangedError ¶ added in v0.17.0
type ContentsChangedError struct {
Gallery *models.Gallery
}
type CountQueryer ¶ added in v0.17.0
type CountQueryer interface {
QueryCount(ctx context.Context, galleryFilter *models.GalleryFilterType, findFilter *models.FindFilterType) (int, error)
}
type Finder ¶ added in v0.17.0
type Finder interface {
FindByPath(ctx context.Context, p string) ([]*models.Gallery, error)
FindUserGalleryByTitle(ctx context.Context, title string) ([]*models.Gallery, error)
FindByFolderID(ctx context.Context, folderID file.FolderID) ([]*models.Gallery, error)
FindByFileID(ctx context.Context, fileID file.ID) ([]*models.Gallery, error)
FindByFingerprints(ctx context.Context, fp []file.Fingerprint) ([]*models.Gallery, error)
}
type FinderByFile ¶ added in v0.17.0
type FinderByFile interface {
FindByFileID(ctx context.Context, fileID file.ID) ([]*models.Gallery, error)
}
type FinderCreatorUpdater ¶ added in v0.17.0
type FinderCreatorUpdater interface {
Finder
Create(ctx context.Context, newGallery *models.Gallery, fileIDs []file.ID) error
UpdatePartial(ctx context.Context, id int, updatedGallery models.GalleryPartial) (*models.Gallery, error)
AddFileID(ctx context.Context, id int, fileID file.ID) error
models.FileLoader
}
type FullCreatorUpdater ¶ added in v0.17.0
type FullCreatorUpdater interface {
FinderCreatorUpdater
Update(ctx context.Context, updatedGallery *models.Gallery) error
}
type ImageFinder ¶ added in v0.17.0
type ImageFinder interface {
FindByFolderID(ctx context.Context, folder file.FolderID) ([]*models.Image, error)
FindByZipFileID(ctx context.Context, zipFileID file.ID) ([]*models.Image, error)
models.GalleryIDLoader
}
type ImageFinderUpdater ¶ added in v0.17.0
type ImageFinderUpdater interface {
FindByZipFileID(ctx context.Context, zipFileID file.ID) ([]*models.Image, error)
UpdatePartial(ctx context.Context, id int, partial models.ImagePartial) (*models.Image, error)
}
type ImageService ¶ added in v0.17.0
type ImageService interface {
Destroy(ctx context.Context, i *models.Image, fileDeleter *image.FileDeleter, deleteGenerated, deleteFile bool) error
DestroyZipImages(ctx context.Context, zipFile file.File, fileDeleter *image.FileDeleter, deleteGenerated bool) ([]*models.Image, error)
}
type ImageUpdater ¶ added in v0.17.0
type ImageUpdater interface {
GetImageIDs(ctx context.Context, galleryID int) ([]int, error)
AddImages(ctx context.Context, galleryID int, imageIDs ...int) error
RemoveImages(ctx context.Context, galleryID int, imageIDs ...int) error
}
type Importer ¶
type Importer struct {
ReaderWriter FullCreatorUpdater
StudioWriter studio.NameFinderCreator
PerformerWriter performer.NameFinderCreator
TagWriter tag.NameFinderCreator
FileFinder file.Getter
FolderFinder file.FolderGetter
Input jsonschema.Gallery
MissingRefBehaviour models.ImportMissingRefEnum
// 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 PartialUpdater ¶ added in v0.17.0
type PartialUpdater interface {
UpdatePartial(ctx context.Context, id int, updatedGallery models.GalleryPartial) (*models.Gallery, error)
}
type Queryer ¶ added in v0.17.0
type Queryer interface {
Query(ctx context.Context, galleryFilter *models.GalleryFilterType, findFilter *models.FindFilterType) ([]*models.Gallery, int, error)
}
type Repository ¶ added in v0.17.0
type Repository interface {
models.GalleryFinder
FinderByFile
Destroy(ctx context.Context, id int) error
models.FileLoader
ImageUpdater
}
type ScanHandler ¶ added in v0.17.0
type ScanHandler struct {
CreatorUpdater FullCreatorUpdater
SceneFinderUpdater SceneFinderUpdater
ImageFinderUpdater ImageFinderUpdater
PluginCache *plugin.Cache
}
type SceneFinderUpdater ¶ added in v0.17.0
type SceneFinderUpdater interface {
FindByPath(ctx context.Context, p string) ([]*models.Scene, error)
Update(ctx context.Context, updatedScene *models.Scene) error
AddGalleryIDs(ctx context.Context, sceneID int, galleryIDs []int) error
}
type Service ¶ added in v0.17.0
type Service struct {
Repository Repository
ImageFinder ImageFinder
ImageService ImageService
File file.Store
Folder file.FolderStore
}
func (*Service) AddImages ¶ added in v0.17.0
func (s *Service) AddImages(ctx context.Context, g *models.Gallery, toAdd ...int) error
AddImages adds images to the provided gallery. It returns an error if the gallery does not support adding images, or if the operation fails.
func (*Service) Destroy ¶ added in v0.17.0
func (s *Service) Destroy(ctx context.Context, i *models.Gallery, fileDeleter *image.FileDeleter, deleteGenerated, deleteFile bool) ([]*models.Image, error)
func (*Service) RemoveImages ¶ added in v0.17.0
func (s *Service) RemoveImages(ctx context.Context, g *models.Gallery, toRemove ...int) error
RemoveImages removes images from the provided gallery. It does not validate if the images are part of the gallery. It returns an error if the gallery does not support removing images, or if the operation fails.
func (*Service) ValidateImageGalleryChange ¶ added in v0.17.0
func (s *Service) ValidateImageGalleryChange(ctx context.Context, i *models.Image, updateIDs models.UpdateIDs) error
Click to show internal directories.
Click to hide internal directories.