Documentation ¶
Index ¶
- func CheckAdminPermission(ctx context.Context, userID int64, permissions ...types.Permission) bool
- func CheckDeletedByURL(ctx context.Context, sourceURL string) bool
- func Cleanup(ctx context.Context) error
- func CreateAdmin(ctx context.Context, userID int64, permissions []types.Permission, grant int64, ...) error
- func CreateArtwork(ctx context.Context, artwork *types.Artwork) (*types.Artwork, error)
- func CreateCachedArtwork(ctx context.Context, artwork *types.Artwork, status types.ArtworkStatus) error
- func CreateCallbackData(ctx context.Context, data string) (id string, err error)
- func CreateFavorite(ctx context.Context, userID, artworkID primitive.ObjectID) (*model.FavoriteModel, error)
- func CreateLike(ctx context.Context, userID, artworkID primitive.ObjectID) error
- func CreateOrUpdateAdmin(ctx context.Context, userID int64, permissions []types.Permission, grant int64, ...) error
- func CreateUnauthUser(ctx context.Context, user *model.UnauthUserModel) (*model.UnauthUserModel, error)
- func CreateUser(ctx context.Context, user *model.UserModel) (*model.UserModel, error)
- func DeleteAdmin(ctx context.Context, userID int64) error
- func DeleteArtworkByID(ctx context.Context, id primitive.ObjectID) error
- func DeleteArtworkByURL(ctx context.Context, sourceURL string) error
- func DeleteCachedArtworkPicture(ctx context.Context, cachedArtwork *model.CachedArtworksModel, ...) error
- func DeleteDeletedByURL(ctx context.Context, sourceURL string) error
- func DeleteEtcData(ctx context.Context, key string) (*mongo.DeleteResult, error)
- func DeleteFavorite(ctx context.Context, userID, artworkID primitive.ObjectID) error
- func DeletePictureByID(ctx context.Context, id primitive.ObjectID) error
- func DeletePictureByMessageID(ctx context.Context, messageID int) errordeprecated
- func DeleteUnauthUser(ctx context.Context, id primitive.ObjectID) error
- func FixTwitterArtists(ctx context.Context, bot *telego.Bot, message *telego.Message)
- func GetAdminByUserID(ctx context.Context, userID int64) (*model.AdminModel, error)
- func GetAdminGroupIDs(ctx context.Context) ([]int64, error)
- func GetAdminUserIDs(ctx context.Context) ([]int64, error)
- func GetArtistByID(ctx context.Context, artistID primitive.ObjectID) (*types.Artist, error)
- func GetArtistByUID(ctx context.Context, uid string, sourceType types.SourceType) (*types.Artist, error)
- func GetArtworkByID(ctx context.Context, id primitive.ObjectID, opts ...*adapter.AdapterOption) (*types.Artwork, error)
- func GetArtworkByMessageID(ctx context.Context, messageID int, opts ...*adapter.AdapterOption) (*types.Artwork, error)deprecated
- func GetArtworkByURL(ctx context.Context, sourceURL string, opts ...*adapter.AdapterOption) (*types.Artwork, error)
- func GetArtworkCount(ctx context.Context, r18 types.R18Type) (int64, error)
- func GetArtworkIDByPicture(ctx context.Context, picture *types.Picture) (primitive.ObjectID, error)
- func GetArtworksByArtistID(ctx context.Context, artistID primitive.ObjectID, r18 types.R18Type, ...) ([]*types.Artwork, error)
- func GetArtworksByTags(ctx context.Context, tags [][]string, r18 types.R18Type, page, pageSize int64, ...) ([]*types.Artwork, error)
- func GetCachedArtworkByURL(ctx context.Context, sourceURL string) (*model.CachedArtworksModel, error)
- func GetCachedArtworkByURLWithCache(ctx context.Context, sourceURL string) (*model.CachedArtworksModel, error)
- func GetCallbackDataByID(ctx context.Context, id string) (string, error)
- func GetDatabaseStats(ctx context.Context) (*stats, error)
- func GetDeletedByURL(ctx context.Context, sourceURL string) (*model.DeletedModel, error)
- func GetEtcData(ctx context.Context, key string) any
- func GetFavorite(ctx context.Context, userID, artworkID primitive.ObjectID) (*model.FavoriteModel, error)
- func GetLatestArtworks(ctx context.Context, r18 types.R18Type, page, pageSize int64, ...) ([]*types.Artwork, error)
- func GetPictureByID(ctx context.Context, id primitive.ObjectID) (*types.Picture, error)
- func GetPictureByMessageID(ctx context.Context, messageID int) (*types.Picture, error)deprecated
- func GetPicturesByHashHammingDistance(ctx context.Context, hash string, distance int) ([]*types.Picture, error)
- func GetRandomArtworks(ctx context.Context, r18 types.R18Type, limit int, ...) ([]*types.Artwork, error)
- func GetRandomTagModels(ctx context.Context, limit int) ([]*model.TagModel, error)
- func GetRandomTags(ctx context.Context, limit int) ([]string, error)
- func GetUnauthUserByID(ctx context.Context, id primitive.ObjectID) (*model.UnauthUserModel, error)
- func GetUnauthUserByUsername(ctx context.Context, username string) (*model.UnauthUserModel, error)
- func GetUserByEmail(ctx context.Context, email string) (*model.UserModel, error)
- func GetUserByID(ctx context.Context, id primitive.ObjectID) (*model.UserModel, error)
- func GetUserByTelegramID(ctx context.Context, telegramID int64) (*model.UserModel, error)
- func GetUserByUsername(ctx context.Context, username string) (*model.UserModel, error)
- func IsAdmin(ctx context.Context, userID int64) (bool, error)
- func ProcessPictureHashAndSizeAndUpdate(ctx context.Context, picture *types.Picture) error
- func ProcessPicturesHashAndSizeAndUpdate(ctx context.Context, bot *telego.Bot, message *telego.Message)
- func QueryArtworksByTexts(ctx context.Context, texts [][]string, r18 types.R18Type, limit int, ...) ([]*types.Artwork, error)
- func QueryArtworksByTextsPage(ctx context.Context, texts [][]string, r18 types.R18Type, page, pageSize int64, ...) ([]*types.Artwork, error)
- func SetEtcData(ctx context.Context, key string, value interface{}) (*mongo.UpdateResult, error)
- func StoragePictureRegularAndThumbAndUpdate(ctx context.Context, picture *model.PictureModel) error
- func StoragePicturesRegularAndThumbAndUpdate(ctx context.Context, bot *telego.Bot, message *telego.Message)
- func TidyArtist(ctx context.Context)
- func TidyArtworkPictureIndexByID(ctx context.Context, artworkID primitive.ObjectID) error
- func UpdateArtworkR18ByID(ctx context.Context, id primitive.ObjectID, r18 bool) error
- func UpdateArtworkR18ByURL(ctx context.Context, sourceURL string, r18 bool) error
- func UpdateArtworkTagsByURL(ctx context.Context, sourceURL string, tags []string) error
- func UpdateArtworkTitleByURL(ctx context.Context, sourceURL, title string) error
- func UpdateCachedArtwork(ctx context.Context, artwork *model.CachedArtworksModel) error
- func UpdateCachedArtworkStatusByURL(ctx context.Context, sourceURL string, status types.ArtworkStatus) error
- func UpdatePictureTelegramInfo(ctx context.Context, picture *types.Picture, telegramInfo *types.TelegramInfo) error
- func UpdateUnauthUser(ctx context.Context, id primitive.ObjectID, user *model.UnauthUserModel) (*model.UnauthUserModel, error)
- func UpdateUserSettings(ctx context.Context, id primitive.ObjectID, settings *model.UserSettings) (*model.UserSettings, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckAdminPermission ¶
func CreateAdmin ¶
func CreateArtwork ¶
func CreateCachedArtwork ¶
func CreateCallbackData ¶
func CreateFavorite ¶
func CreateOrUpdateAdmin ¶
func CreateUnauthUser ¶
func CreateUnauthUser(ctx context.Context, user *model.UnauthUserModel) (*model.UnauthUserModel, error)
func CreateUser ¶
func DeleteEtcData ¶
func DeleteFavorite ¶
func DeletePictureByID ¶
删除单张图片, 如果删除后对应的 artwork 中没有图片, 则也删除 artwork
删除后对 artwork 的 pictures 的 index 进行重整
func DeletePictureByMessageID
deprecated
func FixTwitterArtists ¶
func GetAdminByUserID ¶
func GetArtistByID ¶
func GetArtistByUID ¶
func GetArtworkByID ¶
func GetArtworkByMessageID
deprecated
func GetArtworkByURL ¶
func GetArtworkIDByPicture ¶
func GetArtworksByArtistID ¶
func GetArtworksByTags ¶
func GetArtworksByTags(ctx context.Context, tags [][]string, r18 types.R18Type, page, pageSize int64, convertOpts ...*adapter.AdapterOption) ([]*types.Artwork, error)
通过标签获取作品, 标签名使用全字匹配
tags: 二维数组, tags = [["tag1", "tag2"], ["tag3", "tag4"]] 表示 (tag1 || tag2) && (tag3 || tag4)
func GetCachedArtworkByURL ¶
func GetCachedArtworkByURLWithCache ¶
func GetCachedArtworkByURLWithCache(ctx context.Context, sourceURL string) (*model.CachedArtworksModel, error)
GetCachedArtworkByURLWithCache get cached artwork by sourceURL, if not exist, fetch from source and cache it
func GetDatabaseStats ¶
func GetDeletedByURL ¶
func GetFavorite ¶
func GetLatestArtworks ¶
func GetPictureByID ¶
func GetRandomArtworks ¶
func GetRandomTagModels ¶
func GetUnauthUserByID ¶
func GetUnauthUserByUsername ¶
func GetUserByEmail ¶
func GetUserByID ¶
func GetUserByTelegramID ¶
func GetUserByUsername ¶
func QueryArtworksByTexts ¶
func QueryArtworksByTexts(ctx context.Context, texts [][]string, r18 types.R18Type, limit int, convertOpts ...*adapter.AdapterOption) ([]*types.Artwork, error)
使用tag名, 标题, 描述, 作者名, 作者用户名 综合查询
对于每个关键词, 只要tag名, 标题, 描述, 作者名, 作者用户名中有一个匹配即认为匹配成功
关键词二维数组中, 每个一维数组中的关键词之间是或的关系, 不同一维数组中的关键词之间是与的关系
func SetEtcData ¶
func StoragePictureRegularAndThumbAndUpdate ¶
func StoragePictureRegularAndThumbAndUpdate(ctx context.Context, picture *model.PictureModel) error
func TidyArtist ¶
func TidyArtworkPictureIndexByID ¶
用于删除图片后重整 artwork 的 picture 的 index
func UpdateArtworkR18ByID ¶
func UpdateArtworkR18ByURL ¶
func UpdateArtworkTagsByURL ¶
func UpdateArtworkTitleByURL ¶
func UpdateCachedArtwork ¶
func UpdateCachedArtwork(ctx context.Context, artwork *model.CachedArtworksModel) error
func UpdateUnauthUser ¶
func UpdateUnauthUser(ctx context.Context, id primitive.ObjectID, user *model.UnauthUserModel) (*model.UnauthUserModel, error)
func UpdateUserSettings ¶
func UpdateUserSettings(ctx context.Context, id primitive.ObjectID, settings *model.UserSettings) (*model.UserSettings, error)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.