复制项目
This commit is contained in:
32
pkg/common/db/table/chat/credential.go
Normal file
32
pkg/common/db/table/chat/credential.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package chat
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/openimsdk/tools/db/pagination"
|
||||
)
|
||||
|
||||
type Credential struct {
|
||||
UserID string `bson:"user_id"`
|
||||
Account string `bson:"account"`
|
||||
Type int `bson:"type"` // 1:phone;2:email
|
||||
AllowChange bool `bson:"allow_change"`
|
||||
}
|
||||
|
||||
func (Credential) TableName() string {
|
||||
return "credentials"
|
||||
}
|
||||
|
||||
type CredentialInterface interface {
|
||||
Create(ctx context.Context, credential ...*Credential) error
|
||||
CreateOrUpdateAccount(ctx context.Context, credential *Credential) error
|
||||
Update(ctx context.Context, userID string, data map[string]any) error
|
||||
Find(ctx context.Context, userID string) ([]*Credential, error)
|
||||
FindAccount(ctx context.Context, accounts []string) ([]*Credential, error)
|
||||
Search(ctx context.Context, keyword string, pagination pagination.Pagination) (int64, []*Credential, error)
|
||||
TakeAccount(ctx context.Context, account string) (*Credential, error)
|
||||
Take(ctx context.Context, userID string) (*Credential, error)
|
||||
SearchNormalUser(ctx context.Context, keyword string, forbiddenID []string, pagination pagination.Pagination) (int64, []*Credential, error)
|
||||
SearchUser(ctx context.Context, keyword string, userIDs []string, pagination pagination.Pagination) (int64, []*Credential, error)
|
||||
Delete(ctx context.Context, userIDs []string) error
|
||||
DeleteByUserIDType(ctx context.Context, credentials ...*Credential) error
|
||||
}
|
||||
Reference in New Issue
Block a user