database

package
v1.8.4 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2025 License: GPL-3.0 Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminDatabase

type AdminDatabase struct {
	// contains filtered or unexported fields
}

func (*AdminDatabase) AddAdminAccount

func (o *AdminDatabase) AddAdminAccount(ctx context.Context, admins []*admindb.Admin) error

func (*AdminDatabase) AddDefaultFriend

func (o *AdminDatabase) AddDefaultFriend(ctx context.Context, ms []*admindb.RegisterAddFriend) error

func (*AdminDatabase) AddDefaultGroup

func (o *AdminDatabase) AddDefaultGroup(ctx context.Context, ms []*admindb.RegisterAddGroup) error

func (*AdminDatabase) AddIPForbidden

func (o *AdminDatabase) AddIPForbidden(ctx context.Context, ms []*admindb.IPForbidden) error

func (*AdminDatabase) AddUserLimitLogin

func (o *AdminDatabase) AddUserLimitLogin(ctx context.Context, ms []*admindb.LimitUserLoginIP) error

func (*AdminDatabase) AddVersion added in v1.8.3

func (o *AdminDatabase) AddVersion(ctx context.Context, val *admindb.Application) error

func (*AdminDatabase) BlockUser

func (o *AdminDatabase) BlockUser(ctx context.Context, f []*admindb.ForbiddenAccount) error

func (*AdminDatabase) CacheToken

func (o *AdminDatabase) CacheToken(ctx context.Context, userID string, token string, expire time.Duration) error

func (*AdminDatabase) ChangePassword

func (o *AdminDatabase) ChangePassword(ctx context.Context, userID string, newPassword string) error

func (*AdminDatabase) CountLimitUserLoginIP

func (o *AdminDatabase) CountLimitUserLoginIP(ctx context.Context, userID string) (uint32, error)

func (*AdminDatabase) CreatInvitationRegister

func (o *AdminDatabase) CreatInvitationRegister(ctx context.Context, invitationRegisters []*admindb.InvitationRegister) error

func (*AdminDatabase) CreateApplet

func (o *AdminDatabase) CreateApplet(ctx context.Context, applets []*admindb.Applet) error

func (*AdminDatabase) DelAdminAccount

func (o *AdminDatabase) DelAdminAccount(ctx context.Context, userIDs []string) error

func (*AdminDatabase) DelApplet

func (o *AdminDatabase) DelApplet(ctx context.Context, appletIDs []string) error

func (*AdminDatabase) DelBlockUser

func (o *AdminDatabase) DelBlockUser(ctx context.Context, userID []string) error

func (*AdminDatabase) DelConfig

func (o *AdminDatabase) DelConfig(ctx context.Context, keys []string) error

func (*AdminDatabase) DelDefaultFriend

func (o *AdminDatabase) DelDefaultFriend(ctx context.Context, userIDs []string) error

func (*AdminDatabase) DelDefaultGroup

func (o *AdminDatabase) DelDefaultGroup(ctx context.Context, groupIDs []string) error

func (*AdminDatabase) DelIPForbidden

func (o *AdminDatabase) DelIPForbidden(ctx context.Context, ips []string) error

func (*AdminDatabase) DelInvitationRegister

func (o *AdminDatabase) DelInvitationRegister(ctx context.Context, codes []string) error

func (*AdminDatabase) DelUserLimitLogin

func (o *AdminDatabase) DelUserLimitLogin(ctx context.Context, ms []*admindb.LimitUserLoginIP) error

func (*AdminDatabase) DeleteToken added in v1.8.0

func (o *AdminDatabase) DeleteToken(ctx context.Context, userID string) error

func (*AdminDatabase) DeleteVersion added in v1.8.3

func (o *AdminDatabase) DeleteVersion(ctx context.Context, id []primitive.ObjectID) error

func (*AdminDatabase) FindApplet

func (o *AdminDatabase) FindApplet(ctx context.Context, appletIDs []string) ([]*admindb.Applet, error)

func (*AdminDatabase) FindBlockInfo

func (o *AdminDatabase) FindBlockInfo(ctx context.Context, userIDs []string) ([]*admindb.ForbiddenAccount, error)

func (*AdminDatabase) FindBlockUser

func (o *AdminDatabase) FindBlockUser(ctx context.Context, userIDs []string) ([]*admindb.ForbiddenAccount, error)

func (*AdminDatabase) FindDefaultFriend

func (o *AdminDatabase) FindDefaultFriend(ctx context.Context, userIDs []string) ([]string, error)

func (*AdminDatabase) FindDefaultGroup

func (o *AdminDatabase) FindDefaultGroup(ctx context.Context, groupIDs []string) ([]string, error)

func (*AdminDatabase) FindIPForbidden

func (o *AdminDatabase) FindIPForbidden(ctx context.Context, ms []string) ([]*admindb.IPForbidden, error)

func (*AdminDatabase) FindInvitationRegister

func (o *AdminDatabase) FindInvitationRegister(ctx context.Context, codes []string) ([]*admindb.InvitationRegister, error)

func (*AdminDatabase) FindOnShelf

func (o *AdminDatabase) FindOnShelf(ctx context.Context) ([]*admindb.Applet, error)

func (*AdminDatabase) GetAdmin

func (o *AdminDatabase) GetAdmin(ctx context.Context, account string) (*admindb.Admin, error)

func (*AdminDatabase) GetAdminUserID

func (o *AdminDatabase) GetAdminUserID(ctx context.Context, userID string) (*admindb.Admin, error)

func (*AdminDatabase) GetApplet

func (o *AdminDatabase) GetApplet(ctx context.Context, appletID string) (*admindb.Applet, error)

func (*AdminDatabase) GetBlockInfo

func (o *AdminDatabase) GetBlockInfo(ctx context.Context, userID string) (*admindb.ForbiddenAccount, error)

func (*AdminDatabase) GetConfig

func (o *AdminDatabase) GetConfig(ctx context.Context) (map[string]string, error)

func (*AdminDatabase) GetLimitUserLoginIP

func (o *AdminDatabase) GetLimitUserLoginIP(ctx context.Context, userID string, ip string) (*admindb.LimitUserLoginIP, error)

func (*AdminDatabase) GetTokens

func (o *AdminDatabase) GetTokens(ctx context.Context, userID string) (map[string]int32, error)

func (*AdminDatabase) LatestVersion added in v1.8.3

func (o *AdminDatabase) LatestVersion(ctx context.Context, platform string) (*admindb.Application, error)

func (*AdminDatabase) PageVersion added in v1.8.3

func (o *AdminDatabase) PageVersion(ctx context.Context, platforms []string, page pagination.Pagination) (int64, []*admindb.Application, error)

func (*AdminDatabase) SearchAdminAccount

func (o *AdminDatabase) SearchAdminAccount(ctx context.Context, pagination pagination.Pagination) (int64, []*admindb.Admin, error)

func (*AdminDatabase) SearchApplet

func (o *AdminDatabase) SearchApplet(ctx context.Context, keyword string, pagination pagination.Pagination) (int64, []*admindb.Applet, error)

func (*AdminDatabase) SearchBlockUser

func (o *AdminDatabase) SearchBlockUser(ctx context.Context, keyword string, pagination pagination.Pagination) (int64, []*admindb.ForbiddenAccount, error)

func (*AdminDatabase) SearchDefaultFriend

func (o *AdminDatabase) SearchDefaultFriend(ctx context.Context, keyword string, pagination pagination.Pagination) (int64, []*admindb.RegisterAddFriend, error)

func (*AdminDatabase) SearchDefaultGroup

func (o *AdminDatabase) SearchDefaultGroup(ctx context.Context, keyword string, pagination pagination.Pagination) (int64, []*admindb.RegisterAddGroup, error)

func (*AdminDatabase) SearchIPForbidden

func (o *AdminDatabase) SearchIPForbidden(ctx context.Context, keyword string, state int32, pagination pagination.Pagination) (int64, []*admindb.IPForbidden, error)

func (*AdminDatabase) SearchInvitationRegister

func (o *AdminDatabase) SearchInvitationRegister(ctx context.Context, keyword string, state int32, userIDs []string, codes []string, pagination pagination.Pagination) (int64, []*admindb.InvitationRegister, error)

func (*AdminDatabase) SearchUserLimitLogin

func (o *AdminDatabase) SearchUserLimitLogin(ctx context.Context, keyword string, pagination pagination.Pagination) (int64, []*admindb.LimitUserLoginIP, error)

func (*AdminDatabase) SetConfig

func (o *AdminDatabase) SetConfig(ctx context.Context, cs map[string]string) error

func (*AdminDatabase) UpdateAdmin

func (o *AdminDatabase) UpdateAdmin(ctx context.Context, userID string, update map[string]any) error

func (*AdminDatabase) UpdateApplet

func (o *AdminDatabase) UpdateApplet(ctx context.Context, appletID string, update map[string]any) error

func (*AdminDatabase) UpdateInvitationRegister

func (o *AdminDatabase) UpdateInvitationRegister(ctx context.Context, code string, fields map[string]any) error

func (*AdminDatabase) UpdateVersion added in v1.8.3

func (o *AdminDatabase) UpdateVersion(ctx context.Context, id primitive.ObjectID, update map[string]any) error

type AdminDatabaseInterface

type AdminDatabaseInterface interface {
	GetAdmin(ctx context.Context, account string) (*admindb.Admin, error)
	GetAdminUserID(ctx context.Context, userID string) (*admindb.Admin, error)
	UpdateAdmin(ctx context.Context, userID string, update map[string]any) error
	ChangePassword(ctx context.Context, userID string, newPassword string) error
	AddAdminAccount(ctx context.Context, admin []*admindb.Admin) error
	DelAdminAccount(ctx context.Context, userIDs []string) error
	SearchAdminAccount(ctx context.Context, pagination pagination.Pagination) (int64, []*admindb.Admin, error)
	CreateApplet(ctx context.Context, applets []*admindb.Applet) error
	DelApplet(ctx context.Context, appletIDs []string) error
	GetApplet(ctx context.Context, appletID string) (*admindb.Applet, error)
	FindApplet(ctx context.Context, appletIDs []string) ([]*admindb.Applet, error)
	SearchApplet(ctx context.Context, keyword string, pagination pagination.Pagination) (int64, []*admindb.Applet, error)
	FindOnShelf(ctx context.Context) ([]*admindb.Applet, error)
	UpdateApplet(ctx context.Context, appletID string, update map[string]any) error
	GetConfig(ctx context.Context) (map[string]string, error)
	SetConfig(ctx context.Context, cs map[string]string) error
	DelConfig(ctx context.Context, keys []string) error
	FindInvitationRegister(ctx context.Context, codes []string) ([]*admindb.InvitationRegister, error)
	DelInvitationRegister(ctx context.Context, codes []string) error
	UpdateInvitationRegister(ctx context.Context, code string, fields map[string]any) error
	CreatInvitationRegister(ctx context.Context, invitationRegisters []*admindb.InvitationRegister) error
	SearchInvitationRegister(ctx context.Context, keyword string, state int32, userIDs []string, codes []string, pagination pagination.Pagination) (int64, []*admindb.InvitationRegister, error)
	SearchIPForbidden(ctx context.Context, keyword string, state int32, pagination pagination.Pagination) (int64, []*admindb.IPForbidden, error)
	AddIPForbidden(ctx context.Context, ms []*admindb.IPForbidden) error
	FindIPForbidden(ctx context.Context, ms []string) ([]*admindb.IPForbidden, error)
	DelIPForbidden(ctx context.Context, ips []string) error
	FindDefaultFriend(ctx context.Context, userIDs []string) ([]string, error)
	AddDefaultFriend(ctx context.Context, ms []*admindb.RegisterAddFriend) error
	DelDefaultFriend(ctx context.Context, userIDs []string) error
	SearchDefaultFriend(ctx context.Context, keyword string, pagination pagination.Pagination) (int64, []*admindb.RegisterAddFriend, error)
	FindDefaultGroup(ctx context.Context, groupIDs []string) ([]string, error)
	AddDefaultGroup(ctx context.Context, ms []*admindb.RegisterAddGroup) error
	DelDefaultGroup(ctx context.Context, groupIDs []string) error
	SearchDefaultGroup(ctx context.Context, keyword string, pagination pagination.Pagination) (int64, []*admindb.RegisterAddGroup, error)
	FindBlockInfo(ctx context.Context, userIDs []string) ([]*admindb.ForbiddenAccount, error)
	GetBlockInfo(ctx context.Context, userID string) (*admindb.ForbiddenAccount, error)
	BlockUser(ctx context.Context, f []*admindb.ForbiddenAccount) error
	DelBlockUser(ctx context.Context, userID []string) error
	SearchBlockUser(ctx context.Context, keyword string, pagination pagination.Pagination) (int64, []*admindb.ForbiddenAccount, error)
	FindBlockUser(ctx context.Context, userIDs []string) ([]*admindb.ForbiddenAccount, error)
	SearchUserLimitLogin(ctx context.Context, keyword string, pagination pagination.Pagination) (int64, []*admindb.LimitUserLoginIP, error)
	AddUserLimitLogin(ctx context.Context, ms []*admindb.LimitUserLoginIP) error
	DelUserLimitLogin(ctx context.Context, ms []*admindb.LimitUserLoginIP) error
	CountLimitUserLoginIP(ctx context.Context, userID string) (uint32, error)
	GetLimitUserLoginIP(ctx context.Context, userID string, ip string) (*admindb.LimitUserLoginIP, error)
	CacheToken(ctx context.Context, userID string, token string, expire time.Duration) error
	GetTokens(ctx context.Context, userID string) (map[string]int32, error)
	DeleteToken(ctx context.Context, userID string) error
	LatestVersion(ctx context.Context, platform string) (*admindb.Application, error)
	AddVersion(ctx context.Context, val *admindb.Application) error
	UpdateVersion(ctx context.Context, id primitive.ObjectID, update map[string]any) error
	DeleteVersion(ctx context.Context, id []primitive.ObjectID) error
	PageVersion(ctx context.Context, platforms []string, page pagination.Pagination) (int64, []*admindb.Application, error)
}

type ChatDatabase

type ChatDatabase struct {
	// contains filtered or unexported fields
}

func (*ChatDatabase) AddVerifyCode

func (o *ChatDatabase) AddVerifyCode(ctx context.Context, verifyCode *chatdb.VerifyCode, fn func() error) error

func (*ChatDatabase) CountVerifyCodeRange

func (o *ChatDatabase) CountVerifyCodeRange(ctx context.Context, account string, start time.Time, end time.Time) (int64, error)

func (*ChatDatabase) DelUserAccount added in v1.8.0

func (o *ChatDatabase) DelUserAccount(ctx context.Context, userIDs []string) error

func (*ChatDatabase) DelVerifyCode

func (o *ChatDatabase) DelVerifyCode(ctx context.Context, id string) error

func (*ChatDatabase) FindAttribute

func (o *ChatDatabase) FindAttribute(ctx context.Context, userIDs []string) ([]*chatdb.Attribute, error)

func (*ChatDatabase) FindAttributeByAccount

func (o *ChatDatabase) FindAttributeByAccount(ctx context.Context, accounts []string) ([]*chatdb.Attribute, error)

func (*ChatDatabase) GetUser

func (o *ChatDatabase) GetUser(ctx context.Context, userID string) (account *chatdb.Account, err error)

func (*ChatDatabase) LoginRecord

func (o *ChatDatabase) LoginRecord(ctx context.Context, record *chatdb.UserLoginRecord, verifyCodeID *string) error

func (*ChatDatabase) NewUserCountTotal

func (o *ChatDatabase) NewUserCountTotal(ctx context.Context, before *time.Time) (int64, error)

func (*ChatDatabase) RegisterUser

func (o *ChatDatabase) RegisterUser(ctx context.Context, register *chatdb.Register, account *chatdb.Account, attribute *chatdb.Attribute, credentials []*chatdb.Credential) error

func (*ChatDatabase) Search

func (o *ChatDatabase) Search(ctx context.Context, normalUser int32, keyword string, genders int32, pagination pagination.Pagination) (total int64, attributes []*chatdb.Attribute, err error)

func (*ChatDatabase) SearchUser

func (o *ChatDatabase) SearchUser(ctx context.Context, keyword string, userIDs []string, genders []int32, pagination pagination.Pagination) (int64, []*chatdb.Attribute, error)

func (*ChatDatabase) TakeAccount added in v1.8.3

func (o *ChatDatabase) TakeAccount(ctx context.Context, userID string) (*chatdb.Account, error)

func (*ChatDatabase) TakeAttributeByAccount

func (o *ChatDatabase) TakeAttributeByAccount(ctx context.Context, account string) (*chatdb.Attribute, error)

func (*ChatDatabase) TakeAttributeByEmail

func (o *ChatDatabase) TakeAttributeByEmail(ctx context.Context, email string) (*chatdb.Attribute, error)

func (*ChatDatabase) TakeAttributeByPhone

func (o *ChatDatabase) TakeAttributeByPhone(ctx context.Context, areaCode string, phoneNumber string) (*chatdb.Attribute, error)

func (*ChatDatabase) TakeAttributeByUserID

func (o *ChatDatabase) TakeAttributeByUserID(ctx context.Context, userID string) (*chatdb.Attribute, error)

func (*ChatDatabase) TakeCredentialByAccount added in v1.8.3

func (o *ChatDatabase) TakeCredentialByAccount(ctx context.Context, account string) (*chatdb.Credential, error)

func (*ChatDatabase) TakeCredentialsByUserID added in v1.8.3

func (o *ChatDatabase) TakeCredentialsByUserID(ctx context.Context, userID string) ([]*chatdb.Credential, error)

func (*ChatDatabase) TakeLastVerifyCode

func (o *ChatDatabase) TakeLastVerifyCode(ctx context.Context, account string) (*chatdb.VerifyCode, error)

func (*ChatDatabase) UpdatePassword

func (o *ChatDatabase) UpdatePassword(ctx context.Context, userID string, password string) error

func (*ChatDatabase) UpdatePasswordAndDeleteVerifyCode

func (o *ChatDatabase) UpdatePasswordAndDeleteVerifyCode(ctx context.Context, userID string, password string, codeID string) error

func (*ChatDatabase) UpdateUseInfo

func (o *ChatDatabase) UpdateUseInfo(ctx context.Context, userID string, attribute map[string]any, updateCred, delCred []*chatdb.Credential) (err error)

func (*ChatDatabase) UpdateVerifyCodeIncrCount

func (o *ChatDatabase) UpdateVerifyCodeIncrCount(ctx context.Context, id string) error

func (*ChatDatabase) UserLoginCountRangeEverydayTotal

func (o *ChatDatabase) UserLoginCountRangeEverydayTotal(ctx context.Context, start *time.Time, end *time.Time) (map[string]int64, int64, error)

func (*ChatDatabase) UserLoginCountTotal

func (o *ChatDatabase) UserLoginCountTotal(ctx context.Context, before *time.Time) (int64, error)

type ChatDatabaseInterface

type ChatDatabaseInterface interface {
	GetUser(ctx context.Context, userID string) (account *chatdb.Account, err error)
	UpdateUseInfo(ctx context.Context, userID string, attribute map[string]any, updateCred, delCred []*chatdb.Credential) (err error)
	FindAttribute(ctx context.Context, userIDs []string) ([]*chatdb.Attribute, error)
	FindAttributeByAccount(ctx context.Context, accounts []string) ([]*chatdb.Attribute, error)
	TakeAttributeByPhone(ctx context.Context, areaCode string, phoneNumber string) (*chatdb.Attribute, error)
	TakeAttributeByEmail(ctx context.Context, Email string) (*chatdb.Attribute, error)
	TakeAttributeByAccount(ctx context.Context, account string) (*chatdb.Attribute, error)
	TakeAttributeByUserID(ctx context.Context, userID string) (*chatdb.Attribute, error)
	TakeAccount(ctx context.Context, userID string) (*chatdb.Account, error)
	TakeCredentialByAccount(ctx context.Context, account string) (*chatdb.Credential, error)
	TakeCredentialsByUserID(ctx context.Context, userID string) ([]*chatdb.Credential, error)
	TakeLastVerifyCode(ctx context.Context, account string) (*chatdb.VerifyCode, error)
	Search(ctx context.Context, normalUser int32, keyword string, gender int32, pagination pagination.Pagination) (int64, []*chatdb.Attribute, error)
	SearchUser(ctx context.Context, keyword string, userIDs []string, genders []int32, pagination pagination.Pagination) (int64, []*chatdb.Attribute, error)
	CountVerifyCodeRange(ctx context.Context, account string, start time.Time, end time.Time) (int64, error)
	AddVerifyCode(ctx context.Context, verifyCode *chatdb.VerifyCode, fn func() error) error
	UpdateVerifyCodeIncrCount(ctx context.Context, id string) error
	DelVerifyCode(ctx context.Context, id string) error
	RegisterUser(ctx context.Context, register *chatdb.Register, account *chatdb.Account, attribute *chatdb.Attribute, credentials []*chatdb.Credential) error
	LoginRecord(ctx context.Context, record *chatdb.UserLoginRecord, verifyCodeID *string) error
	UpdatePassword(ctx context.Context, userID string, password string) error
	UpdatePasswordAndDeleteVerifyCode(ctx context.Context, userID string, password string, codeID string) error
	NewUserCountTotal(ctx context.Context, before *time.Time) (int64, error)
	UserLoginCountTotal(ctx context.Context, before *time.Time) (int64, error)
	UserLoginCountRangeEverydayTotal(ctx context.Context, start *time.Time, end *time.Time) (map[string]int64, int64, error)
	DelUserAccount(ctx context.Context, userIDs []string) error
}

func NewChatDatabase

func NewChatDatabase(cli *mongoutil.Client) (ChatDatabaseInterface, error)

Jump to

Keyboard shortcuts

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