Documentation
¶
Index ¶
- func SetDefault(s *Service)
- func WithContext(ctx context.Context, serv *Service) context.Context
- type Option
- type Service
- func (s *Service) AddApiKeyQuota(ctx context.Context, key string, quota int) error
- func (s *Service) AddTagAlias(ctx context.Context, tagID ouid.OUID, alias []string) (*entity.Tag, error)
- func (s *Service) CancelDeletedByURL(ctx context.Context, sourceURL string) error
- func (s *Service) CheckAdminPermissionByTgID(ctx context.Context, userID int64, permissions ...shared.Permission) bool
- func (s *Service) CheckDeletedByURL(ctx context.Context, sourceURL string) bool
- func (s *Service) Cleanup(ctx context.Context) error
- func (s *Service) CountArtworks(ctx context.Context, r18 shared.R18Type) (int64, error)
- func (s *Service) CreateAdmin(ctx context.Context, tgID int64, permissions []shared.Permission) error
- func (s *Service) CreateApiKey(ctx context.Context, key string, quota int, permissions []shared.Permission, ...) (*entity.ApiKey, error)
- func (s *Service) CreateArtwork(ctx context.Context, cmd *command.ArtworkCreation) (*entity.Artwork, error)
- func (s *Service) CreateCachedArtwork(ctx context.Context, ent *entity.CachedArtwork) (*entity.CachedArtwork, error)
- func (s *Service) CreateOrUpdateAdmin(ctx context.Context, tgid int64, permissions []shared.Permission) error
- func (s *Service) DeleteAdminByTgID(ctx context.Context, tgid int64) error
- func (s *Service) DeleteApiKey(ctx context.Context, key string) error
- func (s *Service) DeleteArtworkByID(ctx context.Context, id ouid.OUID) error
- func (s *Service) DeleteArtworkByURL(ctx context.Context, sourceURL string) error
- func (s *Service) DeleteCachedArtworkByURL(ctx context.Context, sourceURL string) error
- func (s *Service) DeletePictureByID(ctx context.Context, id ouid.OUID) error
- func (s *Service) FetchArtworkInfo(ctx context.Context, sourceURL string) (*dto.FetchedArtwork, error)
- func (s *Service) FindSimilarArtworks(ctx context.Context, que *query.ArtworkSimilar) ([]*entity.Artwork, error)
- func (s *Service) FindSourceURL(text string) string
- func (s *Service) GetAdminByTelegramID(ctx context.Context, tgid int64) (*entity.Admin, error)
- func (s *Service) GetAdminGroupIDs(ctx context.Context) ([]int64, error)
- func (s *Service) GetAdminUserIDs(ctx context.Context) ([]int64, error)
- func (s *Service) GetApiKeyByKey(ctx context.Context, key string) (*entity.ApiKey, error)
- func (s *Service) GetArtistByID(ctx context.Context, id ouid.OUID) (*entity.Artist, error)
- func (s *Service) GetArtworkByID(ctx context.Context, id ouid.OUID) (*entity.Artwork, error)
- func (s *Service) GetArtworkByURL(ctx context.Context, sourceURL string) (*entity.Artwork, error)
- func (s *Service) GetCachedArtworkByURL(ctx context.Context, sourceURL string) (*entity.CachedArtwork, error)
- func (s *Service) GetDeletedByURL(ctx context.Context, sourceURL string) (*entity.DeletedRecord, error)
- func (s *Service) GetOrFetchCachedArtwork(ctx context.Context, sourceURL string) (*entity.CachedArtwork, error)
- func (s *Service) GetPictureByID(ctx context.Context, id ouid.OUID) (*entity.Picture, error)
- func (s *Service) GetTagByName(ctx context.Context, name string) (*entity.Tag, error)
- func (s *Service) GetTagByNameWithAlias(ctx context.Context, name string) (*entity.Tag, error)
- func (s *Service) HideCachedArtworkPicture(ctx context.Context, cachedArt *entity.CachedArtwork, picIndex int) error
- func (s *Service) IncreaseApiKeyUsed(ctx context.Context, key string) error
- func (s *Service) IsAdminByTgID(ctx context.Context, tgid int64) (bool, error)
- func (s *Service) PredictAndUpdateArtworkTags(ctx context.Context, artworkID ouid.OUID) error
- func (s *Service) PrettyFileName(artwork shared.ArtworkLike, picture shared.PictureLike) string
- func (s *Service) QueryArtworks(ctx context.Context, que query.ArtworksDB) ([]*entity.Artwork, error)
- func (s *Service) QueryPicturesByPhash(ctx context.Context, que query.PicturesPhash) ([]*entity.Picture, error)
- func (s *Service) RandomPictures(ctx context.Context, limit int) ([]*entity.Picture, error)
- func (s *Service) RandomTags(ctx context.Context, limit int) ([]*entity.Tag, error)
- func (s *Service) ReIndexArtworks(ctx context.Context, ids []ouid.OUID) error
- func (s *Service) SavePicture(ctx context.Context, pic *entity.Picture) error
- func (s *Service) SearchArtworks(ctx context.Context, que *query.ArtworkSearch) ([]*entity.Artwork, error)
- func (s *Service) ShouldTagNewArtwork() bool
- func (s *Service) Source(sourceType shared.SourceType) source.ArtworkSource
- func (s *Service) Sources() map[shared.SourceType]source.ArtworkSource
- func (s *Service) StorageDelete(ctx context.Context, detail shared.StorageDetail) error
- func (s *Service) StorageDeleteArtworkFiles(ctx context.Context, artwork *entity.Artwork) error
- func (s *Service) StorageDeleteByInfo(ctx context.Context, info shared.StorageInfo) error
- func (s *Service) StorageGetFile(ctx context.Context, detail shared.StorageDetail) (*osutil.File, error)
- func (s *Service) StorageSaveAllSize(ctx context.Context, inputPath, storDirPath, fileName string) (*shared.StorageInfo, error)
- func (s *Service) StorageSaveOriginal(ctx context.Context, file io.Reader, storDirPath, fileName string) (*shared.StorageDetail, error)
- func (s *Service) StorageStreamFile(ctx context.Context, detail shared.StorageDetail, w io.Writer) error
- func (s *Service) Tagger() tagging.Tagger
- func (s *Service) UpdateArtworkR18ByID(ctx context.Context, id ouid.OUID, r18 bool) error
- func (s *Service) UpdateArtworkR18ByURL(ctx context.Context, sourceURL string, r18 bool) error
- func (s *Service) UpdateArtworkTagsByURL(ctx context.Context, sourceURL string, tags []string) error
- func (s *Service) UpdateArtworkTitleByURL(ctx context.Context, sourceURL, title string) error
- func (s *Service) UpdateCachedArtwork(ctx context.Context, data *entity.CachedArtworkData) error
- func (s *Service) UpdateCachedArtworkStatusByURL(ctx context.Context, sourceURL string, status shared.ArtworkStatus) error
- func (s *Service) UpdatePictureTelegramInfo(ctx context.Context, id ouid.OUID, tgInfo *shared.TelegramInfo) error
- func (s *Service) UpdateUgoiraTelegramInfo(ctx context.Context, id ouid.OUID, tgInfo *shared.TelegramInfo) error
- func (s *Service) UpdateVideoTelegramInfo(ctx context.Context, id ouid.OUID, tgInfo *shared.TelegramInfo) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetDefault ¶
func SetDefault(s *Service)
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func FromContext ¶
func NewService ¶
func NewService( repos repo.Repositories, searcher search.Searcher, tagger tagging.Tagger, storageMap map[shared.StorageType]storage.Storage, sourceMap map[shared.SourceType]source.ArtworkSource, storCfg runtimecfg.StorageConfig, opts ...Option, ) *Service
func (*Service) AddApiKeyQuota ¶
func (*Service) AddTagAlias ¶
func (s *Service) AddTagAlias(ctx context.Context, tagID ouid.OUID, alias []string) (*entity.Tag, error)
为已有 tag 添加别名
同时检查是否有其他 tag 的 name 为所指定的别名之一, 在添加完成后, 删除这些 tag, 并将其对应的 artwork 添加这个新的 tag (即传入的tagID)
func (*Service) CancelDeletedByURL ¶
func (*Service) CheckAdminPermissionByTgID ¶
func (*Service) CheckDeletedByURL ¶
func (*Service) CountArtworks ¶
func (*Service) CreateAdmin ¶
func (*Service) CreateApiKey ¶
func (*Service) CreateArtwork ¶
func (*Service) CreateCachedArtwork ¶
func (s *Service) CreateCachedArtwork(ctx context.Context, ent *entity.CachedArtwork) (*entity.CachedArtwork, error)
func (*Service) CreateOrUpdateAdmin ¶
func (*Service) DeleteAdminByTgID ¶
func (*Service) DeleteApiKey ¶
func (*Service) DeleteArtworkByID ¶
func (*Service) DeleteArtworkByURL ¶
func (*Service) DeleteCachedArtworkByURL ¶
func (*Service) DeletePictureByID ¶
删除单张图片, 如果删除后对应的 artwork 中没有图片, 则也删除 artwork
删除后对 artwork 的 pictures 的 index 进行重整, 并在 cached_artwork 中将对应的图片标记为隐藏
func (*Service) FetchArtworkInfo ¶
func (*Service) FindSimilarArtworks ¶
func (*Service) FindSourceURL ¶
func (*Service) GetAdminByTelegramID ¶
func (*Service) GetAdminGroupIDs ¶
func (*Service) GetAdminUserIDs ¶
func (*Service) GetApiKeyByKey ¶
func (*Service) GetArtistByID ¶
func (*Service) GetArtworkByID ¶
func (*Service) GetArtworkByURL ¶
func (*Service) GetCachedArtworkByURL ¶
func (*Service) GetDeletedByURL ¶
func (*Service) GetOrFetchCachedArtwork ¶
func (*Service) GetPictureByID ¶
func (*Service) GetTagByName ¶
func (*Service) GetTagByNameWithAlias ¶
func (*Service) HideCachedArtworkPicture ¶
func (*Service) IncreaseApiKeyUsed ¶
func (*Service) IsAdminByTgID ¶
func (*Service) PredictAndUpdateArtworkTags ¶
func (*Service) PrettyFileName ¶
func (s *Service) PrettyFileName(artwork shared.ArtworkLike, picture shared.PictureLike) string
func (*Service) QueryArtworks ¶
func (*Service) QueryPicturesByPhash ¶
func (*Service) RandomPictures ¶
func (*Service) RandomTags ¶
func (*Service) ReIndexArtworks ¶ added in v1.6.0
func (*Service) SavePicture ¶
only used for updates, do not use for create
func (*Service) SearchArtworks ¶
func (*Service) ShouldTagNewArtwork ¶
func (*Service) Source ¶
func (s *Service) Source(sourceType shared.SourceType) source.ArtworkSource
func (*Service) Sources ¶
func (s *Service) Sources() map[shared.SourceType]source.ArtworkSource
func (*Service) StorageDelete ¶
func (*Service) StorageDeleteArtworkFiles ¶ added in v1.5.0
删除作品的全部文件, 用于删除作品后调用
func (*Service) StorageDeleteByInfo ¶
func (*Service) StorageGetFile ¶
func (*Service) StorageSaveAllSize ¶
func (*Service) StorageSaveOriginal ¶
func (*Service) StorageStreamFile ¶
func (*Service) UpdateArtworkR18ByID ¶
func (*Service) UpdateArtworkR18ByURL ¶
func (*Service) UpdateArtworkTagsByURL ¶
func (*Service) UpdateArtworkTitleByURL ¶
func (*Service) UpdateCachedArtwork ¶
func (*Service) UpdateCachedArtworkStatusByURL ¶
func (*Service) UpdatePictureTelegramInfo ¶
func (*Service) UpdateUgoiraTelegramInfo ¶
func (*Service) UpdateVideoTelegramInfo ¶ added in v1.5.0
Click to show internal directories.
Click to hide internal directories.