Files
chat-deploy/pkg/common/db/table/chat/credential.go
kim.dev.6789 b7f8db7d08 复制项目
2026-01-14 22:35:45 +08:00

33 lines
1.3 KiB
Go

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
}