dao

package
v0.38.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Client *mongo.Client

Functions

func AddLikeCountToArtwork

func AddLikeCountToArtwork(ctx context.Context) error

func CheckDeletedByURL

func CheckDeletedByURL(ctx context.Context, sourceURL string) bool

func CleanPostingCachedArtwork

func CleanPostingCachedArtwork(ctx context.Context) (*mongo.DeleteResult, error)

func ConvertArtistUIDToString

func ConvertArtistUIDToString(ctx context.Context) error

func CreateAdmin

func CreateAdmin(ctx context.Context, admin *model.AdminModel) (*mongo.InsertOneResult, error)

func CreateArtist

func CreateArtist(ctx context.Context, artist *model.ArtistModel) (*mongo.InsertOneResult, error)

func CreateArtwork

func CreateArtwork(ctx context.Context, artwork *model.ArtworkModel) (*mongo.InsertOneResult, error)

func CreateCachedArtwork

func CreateCachedArtwork(ctx context.Context, artwork *types.Artwork, status types.ArtworkStatus) (*mongo.InsertOneResult, error)

func CreateCallbackData

func CreateCallbackData(ctx context.Context, data string) (*model.CallbackDataModel, error)

func CreateDeleted

func CreateDeleted(ctx context.Context, deleted *model.DeletedModel) (*mongo.InsertOneResult, error)

func CreateFavorite

func CreateFavorite(ctx context.Context, userID, artworkID primitive.ObjectID) (*mongo.InsertOneResult, error)

func CreateLike

func CreateLike(ctx context.Context, like *model.LikeModel) (*mongo.InsertOneResult, error)

func CreatePicture

func CreatePicture(ctx context.Context, picture *model.PictureModel) (*mongo.InsertOneResult, error)

func CreatePictures

func CreatePictures(ctx context.Context, pictures []*model.PictureModel) (*mongo.InsertManyResult, error)

func CreateSuperAdminByUserID

func CreateSuperAdminByUserID(ctx context.Context, userID int64, grant int64) (*mongo.InsertOneResult, error)

func CreateTag

func CreateTag(ctx context.Context, tag *model.TagModel) (*mongo.InsertOneResult, error)

func CreateTags

func CreateTags(ctx context.Context, tags []*model.TagModel) (*mongo.InsertManyResult, error)

func CreateUnauthUser

func CreateUnauthUser(ctx context.Context, user *model.UnauthUserModel) (*mongo.InsertOneResult, error)

func CreateUser

func CreateUser(ctx context.Context, user *model.UserModel) (*mongo.InsertOneResult, error)

func DeleteAdminByUserID

func DeleteAdminByUserID(ctx context.Context, userID int64) (*mongo.DeleteResult, error)

func DeleteArtworkByID

func DeleteArtworkByID(ctx context.Context, id primitive.ObjectID) (*mongo.DeleteResult, error)

func DeleteDeletedByURL

func DeleteDeletedByURL(ctx context.Context, sourceURL string) (*mongo.DeleteResult, error)

func DeleteEtcData

func DeleteEtcData(ctx context.Context, key string) (*mongo.DeleteResult, error)

func DeleteFavorite

func DeleteFavorite(ctx context.Context, userID, artworkID primitive.ObjectID) (*mongo.DeleteResult, error)

func DeletePictureByID

func DeletePictureByID(ctx context.Context, id primitive.ObjectID) (*mongo.DeleteResult, error)

func DeletePicturesByArtworkID

func DeletePicturesByArtworkID(ctx context.Context, artworkID primitive.ObjectID) (*mongo.DeleteResult, error)

func DeleteUnauthUser

func DeleteUnauthUser(ctx context.Context, id primitive.ObjectID) (*mongo.DeleteResult, error)

func GetAdminByUserID

func GetAdminByUserID(ctx context.Context, userID int64) (*model.AdminModel, error)

func GetAdmins

func GetAdmins(ctx context.Context) ([]model.AdminModel, error)

func GetArtistByID

func GetArtistByID(ctx context.Context, id primitive.ObjectID) (*model.ArtistModel, error)

func GetArtistByUID

func GetArtistByUID(ctx context.Context, uid string, sourceType types.SourceType) (*model.ArtistModel, error)

func GetArtistByUserName

func GetArtistByUserName(ctx context.Context, username string, sourceType types.SourceType) (*model.ArtistModel, error)

func GetArtistCount

func GetArtistCount(ctx context.Context) (int64, error)

func GetArtworkByID

func GetArtworkByID(ctx context.Context, id primitive.ObjectID) (*model.ArtworkModel, error)

func GetArtworkByURL

func GetArtworkByURL(ctx context.Context, url string) (*model.ArtworkModel, error)

func GetArtworkCount

func GetArtworkCount(ctx context.Context, r18 types.R18Type) (int64, error)

func GetArtworkCountByArtistID

func GetArtworkCountByArtistID(ctx context.Context, artistID primitive.ObjectID, r18 types.R18Type) (int64, error)

func GetArtworksByArtistID

func GetArtworksByArtistID(ctx context.Context, artistID primitive.ObjectID, r18 types.R18Type, page, pageSize int64) ([]*model.ArtworkModel, error)

func GetArtworksByR18

func GetArtworksByR18(ctx context.Context, r18 types.R18Type, limit int) ([]*model.ArtworkModel, error)

func GetArtworksByTags

func GetArtworksByTags(ctx context.Context, tags [][]primitive.ObjectID, r18 types.R18Type, page, pageSize int64) ([]*model.ArtworkModel, error)

func GetCachedArtworkByURL

func GetCachedArtworkByURL(ctx context.Context, url string) (*model.CachedArtworksModel, error)

func GetCallbackDataByID

func GetCallbackDataByID(ctx context.Context, id primitive.ObjectID) (*model.CallbackDataModel, error)

func GetDeletedByURL

func GetDeletedByURL(ctx context.Context, sourceURL string) (*model.DeletedModel, error)

func GetEtcData

func GetEtcData(ctx context.Context, key string) (bson.M, error)

func GetFavorite

func GetFavorite(ctx context.Context, userID, artworkID primitive.ObjectID) (*model.FavoriteModel, error)

func GetLatestArtworks

func GetLatestArtworks(ctx context.Context, r18 types.R18Type, page, pageSize int64) ([]*model.ArtworkModel, error)

func GetLike

func GetLike(ctx context.Context, userID, artworkID primitive.ObjectID) (*model.LikeModel, error)

func GetNoHashPictures

func GetNoHashPictures(ctx context.Context) ([]*model.PictureModel, error)

func GetNoRegularAndThumbPictures

func GetNoRegularAndThumbPictures(ctx context.Context) ([]*model.PictureModel, error)

func GetPictureByID

func GetPictureByID(ctx context.Context, id primitive.ObjectID) (*model.PictureModel, error)

func GetPictureByMessageID deprecated

func GetPictureByMessageID(ctx context.Context, messageID int) (*model.PictureModel, error)

Deprecated: MessageID 现在可能为 0

func GetPictureByOriginal

func GetPictureByOriginal(ctx context.Context, original string) (*model.PictureModel, error)

func GetPictureCount

func GetPictureCount(ctx context.Context) (int64, error)

func GetPicturesByHash

func GetPicturesByHash(ctx context.Context, hash string) ([]*model.PictureModel, error)

func GetPicturesByHashHammingDistance

func GetPicturesByHashHammingDistance(ctx context.Context, hashStr string, distance int) ([]*model.PictureModel, error)

全库遍历搜索

func GetRandomTags

func GetRandomTags(ctx context.Context, limit int) ([]*model.TagModel, error)

func GetTagByID

func GetTagByID(ctx context.Context, id primitive.ObjectID) (*model.TagModel, error)

func GetTagByName

func GetTagByName(ctx context.Context, name string) (*model.TagModel, error)

func GetTagCount

func GetTagCount(ctx context.Context) (int64, error)

func GetUnauthUserByID

func GetUnauthUserByID(ctx context.Context, id primitive.ObjectID) (*model.UnauthUserModel, error)

func GetUnauthUserByUsername

func GetUnauthUserByUsername(ctx context.Context, username string) (*model.UnauthUserModel, error)

func GetUserByEmail

func GetUserByEmail(ctx context.Context, email string) (*model.UserModel, error)

func GetUserByID

func GetUserByID(ctx context.Context, id primitive.ObjectID) (*model.UserModel, error)

func GetUserByTelegramID

func GetUserByTelegramID(ctx context.Context, telegramID int64) (*model.UserModel, error)

func GetUserByUsername

func GetUserByUsername(ctx context.Context, username string) (*model.UserModel, error)

func IncrementArtworkLikeCountByID

func IncrementArtworkLikeCountByID(ctx context.Context, id primitive.ObjectID) (*mongo.UpdateResult, error)

func InitDB

func InitDB(ctx context.Context)

func MigrateStorageInfo

func MigrateStorageInfo(ctx context.Context) error

func QueryArtistsByName

func QueryArtistsByName(ctx context.Context, name string) ([]*model.ArtistModel, error)

func QueryArtistsByUserName

func QueryArtistsByUserName(ctx context.Context, username string) ([]*model.ArtistModel, error)

func QueryArtworksByTexts

func QueryArtworksByTexts(ctx context.Context, texts [][]string, r18 types.R18Type, limit int) ([]*model.ArtworkModel, error)

func QueryArtworksByTextsPage

func QueryArtworksByTextsPage(ctx context.Context, texts [][]string, r18 types.R18Type, page, pageSize int64) ([]*model.ArtworkModel, error)

func QueryTagsByName

func QueryTagsByName(ctx context.Context, name string) ([]*model.TagModel, error)

func SetEtcData

func SetEtcData(ctx context.Context, key string, value any) (*mongo.UpdateResult, error)

func TidyArtist

func TidyArtist(ctx context.Context) error

func UpdateAdmin

func UpdateAdmin(ctx context.Context, admin *model.AdminModel) (*mongo.UpdateResult, error)

func UpdateArtist

func UpdateArtist(ctx context.Context, artist *model.ArtistModel) (*mongo.UpdateResult, error)

func UpdateArtworkPicturesByID

func UpdateArtworkPicturesByID(ctx context.Context, id primitive.ObjectID, pictures []primitive.ObjectID) (*mongo.UpdateResult, error)

func UpdateArtworkR18ByID

func UpdateArtworkR18ByID(ctx context.Context, id primitive.ObjectID, r18 bool) (*mongo.UpdateResult, error)

func UpdateArtworkTagsByID

func UpdateArtworkTagsByID(ctx context.Context, id primitive.ObjectID, tags []primitive.ObjectID) (*mongo.UpdateResult, error)

func UpdateArtworkTitleByID

func UpdateArtworkTitleByID(ctx context.Context, id primitive.ObjectID, title string) (*mongo.UpdateResult, error)

func UpdateCachedArtwork

func UpdateCachedArtwork(ctx context.Context, artwork *model.CachedArtworksModel) (*mongo.UpdateResult, error)

func UpdateCachedArtworkStatusByURL

func UpdateCachedArtworkStatusByURL(ctx context.Context, url string, status types.ArtworkStatus) (*mongo.UpdateResult, error)

func UpdatePictureHashAndBlurScoreByID

func UpdatePictureHashAndBlurScoreByID(ctx context.Context, id primitive.ObjectID, hash string, blurScore float64) (*mongo.UpdateResult, error)

func UpdatePictureIndexByID

func UpdatePictureIndexByID(ctx context.Context, id primitive.ObjectID, index uint) (*mongo.UpdateResult, error)

func UpdatePictureSizeByID

func UpdatePictureSizeByID(ctx context.Context, id primitive.ObjectID, width, height int) (*mongo.UpdateResult, error)

func UpdatePictureStorageInfoByID

func UpdatePictureStorageInfoByID(ctx context.Context, id primitive.ObjectID, storageInfo *types.StorageInfo) (*mongo.UpdateResult, error)

func UpdatePictureTelegramInfoByID

func UpdatePictureTelegramInfoByID(ctx context.Context, id primitive.ObjectID, telegramInfo *types.TelegramInfo) (*mongo.UpdateResult, error)

func UpdateUserSettings

func UpdateUserSettings(ctx context.Context, id primitive.ObjectID, settings *model.UserSettings) (*mongo.UpdateResult, error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL