Documentation
¶
Index ¶
- Variables
- func Init(ctx context.Context)
- type DB
- func (d *DB) APIKey() repo.APIKey
- func (d *DB) AddApiKeyQuota(ctx context.Context, key string, quota int) error
- func (d *DB) Admin() repo.Admin
- func (d *DB) Artist() repo.Artist
- func (d *DB) Artwork() repo.Artwork
- func (d *DB) CachedArtwork() repo.CachedArtwork
- func (d *DB) CheckDeletedByURL(ctx context.Context, sourceURL string) bool
- func (d *DB) CountArtworks(ctx context.Context, r18 shared.R18Type) (int64, error)
- func (d *DB) CreateAdmin(ctx context.Context, admin *entity.Admin) (*ouid.OUID, error)
- func (d *DB) CreateApiKey(ctx context.Context, apiKey *entity.ApiKey) (*ouid.OUID, error)
- func (d *DB) CreateArtist(ctx context.Context, artist *entity.Artist) (*ouid.OUID, error)
- func (d *DB) CreateArtwork(ctx context.Context, artwork *entity.Artwork) (*ouid.OUID, error)
- func (d *DB) CreateCachedArtwork(ctx context.Context, data *entity.CachedArtwork) (*entity.CachedArtwork, error)
- func (d *DB) CreateDeletedRecord(ctx context.Context, deleted *entity.DeletedRecord) error
- func (d *DB) CreateTag(ctx context.Context, tag *entity.Tag) (*entity.Tag, error)
- func (d *DB) DeleteAdminByTelegramID(ctx context.Context, telegramID int64) error
- func (d *DB) DeleteApiKey(ctx context.Context, key string) error
- func (d *DB) DeleteArtworkByID(ctx context.Context, id ouid.OUID) error
- func (d *DB) DeleteArtworkByURL(ctx context.Context, url string) error
- func (d *DB) DeleteCachedArtworkByID(ctx context.Context, id ouid.OUID) error
- func (d *DB) DeleteCachedArtworkByURL(ctx context.Context, sourceUrl string) error
- func (d *DB) DeleteDeletedByURL(ctx context.Context, sourceURL string) error
- func (d *DB) DeletePictureByID(ctx context.Context, id ouid.OUID) error
- func (d *DB) DeleteTagByID(ctx context.Context, id ouid.OUID) error
- func (d *DB) DeletedRecord() repo.DeletedRecord
- func (d *DB) GetAdminByTelegramID(ctx context.Context, telegramID int64) (*entity.Admin, error)
- func (d *DB) GetAliasTagByName(ctx context.Context, name string) (*entity.TagAlias, error)
- func (d *DB) GetApiKeyByKey(ctx context.Context, key string) (*entity.ApiKey, error)
- func (d *DB) GetArtistByID(ctx context.Context, id ouid.OUID) (*entity.Artist, error)
- func (d *DB) GetArtistByUID(ctx context.Context, uid string, source shared.SourceType) (*entity.Artist, error)
- func (d *DB) GetArtworkByID(ctx context.Context, id ouid.OUID) (*entity.Artwork, error)
- func (d *DB) GetArtworkByURL(ctx context.Context, url string) (*entity.Artwork, error)
- func (d *DB) GetArtworksByIDs(ctx context.Context, ids []ouid.OUID) ([]*entity.Artwork, error)
- func (d *DB) GetCachedArtworkByID(ctx context.Context, id ouid.OUID) (*entity.CachedArtwork, error)
- func (d *DB) GetCachedArtworkByURL(ctx context.Context, sourceUrl string) (*entity.CachedArtwork, error)
- func (d *DB) GetDeletedByURL(ctx context.Context, sourceURL string) (*entity.DeletedRecord, error)
- func (d *DB) GetPictureByID(ctx context.Context, id ouid.OUID) (*entity.Picture, error)
- func (d *DB) GetTagByID(ctx context.Context, id ouid.OUID) (*entity.Tag, error)
- func (d *DB) GetTagByName(ctx context.Context, name string) (*entity.Tag, error)
- func (d *DB) GetTagByNameWithAlias(ctx context.Context, name string) (*entity.Tag, error)
- func (d *DB) GetUgoiraByID(ctx context.Context, id ouid.OUID) (*entity.UgoiraMeta, error)
- func (d *DB) GetVideoByID(ctx context.Context, id ouid.OUID) (*entity.Video, error)
- func (d *DB) IncreaseApiKeyUsed(ctx context.Context, key string) error
- func (d *DB) ListAdmins(ctx context.Context) ([]entity.Admin, error)
- func (d *DB) MigrateTagAlias(ctx context.Context, aliasTagID, targetTagID ouid.OUID) ([]ouid.OUID, error)
- func (d *DB) Picture() repo.Picture
- func (d *DB) QueryArtworks(ctx context.Context, que query.ArtworksDB) ([]*entity.Artwork, error)
- func (d *DB) QueryPicturesByPhash(ctx context.Context, que query.PicturesPhash) ([]*entity.Picture, error)
- func (d *DB) RandomPictures(ctx context.Context, limit int) ([]*entity.Picture, error)
- func (d *DB) RandomTags(ctx context.Context, limit int) ([]*entity.Tag, error)
- func (d *DB) ReorderArtworkPicturesByID(ctx context.Context, artworkID ouid.OUID) error
- func (d *DB) ResetPostingCachedArtworkStatus(ctx context.Context) error
- func (d *DB) SaveCachedArtwork(ctx context.Context, artwork *entity.CachedArtwork) (*entity.CachedArtwork, error)
- func (d *DB) SavePicture(ctx context.Context, pic *entity.Picture) error
- func (d *DB) Tag() repo.Tag
- func (d *DB) Transaction(ctx context.Context, fn func(repos repo.Repositories) error) error
- func (d *DB) Ugoira() repo.Ugoira
- func (d *DB) UpdateAdminPermissions(ctx context.Context, id ouid.OUID, permissions []shared.Permission) error
- func (d *DB) UpdateArtist(ctx context.Context, patch *entity.Artist) error
- func (d *DB) UpdateArtwork(ctx context.Context, patch *entity.Artwork) error
- func (d *DB) UpdateArtworkByMap(ctx context.Context, id ouid.OUID, patch map[string]any) error
- func (d *DB) UpdateArtworkPictures(ctx context.Context, id ouid.OUID, pics []*entity.Picture) error
- func (d *DB) UpdateArtworkTags(ctx context.Context, id ouid.OUID, tags []*entity.Tag) error
- func (d *DB) UpdateCachedArtworkStatusByURL(ctx context.Context, sourceUrl string, status shared.ArtworkStatus) error
- func (d *DB) UpdatePictureTelegramInfoByID(ctx context.Context, id ouid.OUID, tgInfo *shared.TelegramInfo) (*entity.Picture, error)
- func (d *DB) UpdateTagAlias(ctx context.Context, id ouid.OUID, alias []*entity.TagAlias) error
- func (d *DB) UpdateUgoiraTelegramInfoByID(ctx context.Context, id ouid.OUID, tgInfo *shared.TelegramInfo) (*entity.UgoiraMeta, error)
- func (d *DB) UpdateVideoTelegramInfoByID(ctx context.Context, id ouid.OUID, tgInfo *shared.TelegramInfo) (*entity.Video, error)
- func (d *DB) Video() repo.Video
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrRecordNotFound = gorm.ErrRecordNotFound
)
Functions ¶
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) AddApiKeyQuota ¶
func (*DB) CachedArtwork ¶
func (d *DB) CachedArtwork() repo.CachedArtwork
CachedArtwork implements repo.Repositories.
func (*DB) CheckDeletedByURL ¶
func (*DB) CountArtworks ¶
func (*DB) CreateAdmin ¶
func (*DB) CreateApiKey ¶
func (*DB) CreateArtist ¶
func (*DB) CreateArtwork ¶
func (*DB) CreateCachedArtwork ¶
func (d *DB) CreateCachedArtwork(ctx context.Context, data *entity.CachedArtwork) (*entity.CachedArtwork, error)
func (*DB) CreateDeletedRecord ¶
func (*DB) DeleteAdminByTelegramID ¶
func (*DB) DeleteArtworkByID ¶
func (*DB) DeleteArtworkByURL ¶
func (*DB) DeleteCachedArtworkByID ¶
func (*DB) DeleteCachedArtworkByURL ¶
func (*DB) DeleteDeletedByURL ¶
func (*DB) DeletePictureByID ¶
在数据库删除单张图片, 不做任何额外操作
func (*DB) DeletedRecord ¶
func (d *DB) DeletedRecord() repo.DeletedRecord
DeletedRecord implements repo.Repositories.
func (*DB) GetAdminByTelegramID ¶
func (*DB) GetAliasTagByName ¶
func (*DB) GetApiKeyByKey ¶
func (*DB) GetArtistByID ¶
func (*DB) GetArtistByUID ¶
func (*DB) GetArtworkByID ¶
func (*DB) GetArtworkByURL ¶
func (*DB) GetArtworksByIDs ¶
func (*DB) GetCachedArtworkByID ¶
GetCachedArtworkByID implements repo.CachedArtwork.
func (*DB) GetCachedArtworkByURL ¶
func (*DB) GetDeletedByURL ¶
func (*DB) GetPictureByID ¶
func (*DB) GetTagByID ¶
func (*DB) GetTagByName ¶
func (*DB) GetTagByNameWithAlias ¶
func (*DB) GetUgoiraByID ¶
func (*DB) GetVideoByID ¶ added in v1.5.0
func (*DB) IncreaseApiKeyUsed ¶
func (*DB) MigrateTagAlias ¶
func (d *DB) MigrateTagAlias(ctx context.Context, aliasTagID, targetTagID ouid.OUID) ([]ouid.OUID, error)
MigrateTagAlias 迁移别名标签到目标标签,并删除别名标签
返回受影响的 artwork ids
func (*DB) QueryArtworks ¶
func (*DB) QueryPicturesByPhash ¶
func (*DB) RandomPictures ¶
RandomPictures implements repo.Picture.
func (*DB) RandomTags ¶
func (*DB) ReorderArtworkPicturesByID ¶
func (*DB) ResetPostingCachedArtworkStatus ¶
func (*DB) SaveCachedArtwork ¶
func (d *DB) SaveCachedArtwork(ctx context.Context, artwork *entity.CachedArtwork) (*entity.CachedArtwork, error)
func (*DB) Transaction ¶
Transaction implements repo.Repositories.
func (*DB) UpdateAdminPermissions ¶
func (*DB) UpdateArtist ¶
func (*DB) UpdateArtwork ¶
UpdateArtwork updates non-zero fields in the patch.
func (*DB) UpdateArtworkByMap ¶
UpdateArtworkByMap updates all given fields in the patch map.
func (*DB) UpdateArtworkPictures ¶
func (*DB) UpdateArtworkTags ¶
func (*DB) UpdateCachedArtworkStatusByURL ¶
func (*DB) UpdatePictureTelegramInfoByID ¶
func (*DB) UpdateTagAlias ¶
func (*DB) UpdateUgoiraTelegramInfoByID ¶
func (d *DB) UpdateUgoiraTelegramInfoByID(ctx context.Context, id ouid.OUID, tgInfo *shared.TelegramInfo) (*entity.UgoiraMeta, error)
UpdateUgoiraTelegramInfoByID implements repo.Ugoira.
func (*DB) UpdateVideoTelegramInfoByID ¶ added in v1.5.0
func (d *DB) UpdateVideoTelegramInfoByID(ctx context.Context, id ouid.OUID, tgInfo *shared.TelegramInfo) (*entity.Video, error)
UpdateVideoTelegramInfoByID implements repo.Video.
Click to show internal directories.
Click to hide internal directories.