chat

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: 3 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 Account

type Account struct {
	UserID         string    `bson:"user_id"`
	Password       string    `bson:"password"`
	CreateTime     time.Time `bson:"create_time"`
	ChangeTime     time.Time `bson:"change_time"`
	OperatorUserID string    `bson:"operator_user_id"`
}

func (Account) TableName

func (Account) TableName() string

type AccountInterface

type AccountInterface interface {
	Create(ctx context.Context, accounts ...*Account) error
	Take(ctx context.Context, userId string) (*Account, error)
	Update(ctx context.Context, userID string, data map[string]any) error
	UpdatePassword(ctx context.Context, userId string, password string) error
	Delete(ctx context.Context, userIDs []string) error
}

type Attribute

type Attribute struct {
	UserID           string    `bson:"user_id"`
	Account          string    `bson:"account"`
	PhoneNumber      string    `bson:"phone_number"`
	AreaCode         string    `bson:"area_code"`
	Email            string    `bson:"email"`
	Nickname         string    `bson:"nickname"`
	FaceURL          string    `bson:"face_url"`
	Gender           int32     `bson:"gender"`
	CreateTime       time.Time `bson:"create_time"`
	ChangeTime       time.Time `bson:"change_time"`
	BirthTime        time.Time `bson:"birth_time"`
	Level            int32     `bson:"level"`
	AllowVibration   int32     `bson:"allow_vibration"`
	AllowBeep        int32     `bson:"allow_beep"`
	AllowAddFriend   int32     `bson:"allow_add_friend"`
	GlobalRecvMsgOpt int32     `bson:"global_recv_msg_opt"`
	RegisterType     int32     `bson:"register_type"`
}

func (Attribute) TableName

func (Attribute) TableName() string

type AttributeInterface

type AttributeInterface interface {
	// NewTx(tx any) AttributeInterface
	Create(ctx context.Context, attribute ...*Attribute) error
	Update(ctx context.Context, userID string, data map[string]any) error
	Find(ctx context.Context, userIds []string) ([]*Attribute, error)
	FindAccount(ctx context.Context, accounts []string) ([]*Attribute, error)
	Search(ctx context.Context, keyword string, genders []int32, pagination pagination.Pagination) (int64, []*Attribute, error)
	TakePhone(ctx context.Context, areaCode string, phoneNumber string) (*Attribute, error)
	TakeEmail(ctx context.Context, email string) (*Attribute, error)
	TakeAccount(ctx context.Context, account string) (*Attribute, error)
	Take(ctx context.Context, userID string) (*Attribute, error)
	SearchNormalUser(ctx context.Context, keyword string, forbiddenID []string, gender int32, pagination pagination.Pagination) (int64, []*Attribute, error)
	SearchUser(ctx context.Context, keyword string, userIDs []string, genders []int32, pagination pagination.Pagination) (int64, []*Attribute, error)
	Delete(ctx context.Context, userIDs []string) error
}

type Credential added in v1.8.3

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 added in v1.8.3

func (Credential) TableName() string

type CredentialInterface added in v1.8.3

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
}

type Register

type Register struct {
	UserID      string    `bson:"user_id"`
	DeviceID    string    `bson:"device_id"`
	IP          string    `bson:"ip"`
	Platform    string    `bson:"platform"`
	AccountType string    `bson:"account_type"`
	Mode        string    `bson:"mode"`
	CreateTime  time.Time `bson:"create_time"`
}

func (Register) TableName

func (Register) TableName() string

type RegisterInterface

type RegisterInterface interface {
	// NewTx(tx any) RegisterInterface
	Create(ctx context.Context, registers ...*Register) error
	CountTotal(ctx context.Context, before *time.Time) (int64, error)
	Delete(ctx context.Context, userIDs []string) error
}

type UserLoginRecord

type UserLoginRecord struct {
	UserID    string    `bson:"user_id"`
	LoginTime time.Time `bson:"login_time"`
	IP        string    `bson:"ip"`
	DeviceID  string    `bson:"device_id"`
	Platform  string    `bson:"platform"`
}

func (UserLoginRecord) TableName

func (UserLoginRecord) TableName() string

type UserLoginRecordInterface

type UserLoginRecordInterface interface {
	Create(ctx context.Context, records ...*UserLoginRecord) error
	CountTotal(ctx context.Context, before *time.Time) (int64, error)
	CountRangeEverydayTotal(ctx context.Context, start *time.Time, end *time.Time) (map[string]int64, int64, error)
}

type VerifyCode

type VerifyCode struct {
	ID         string    `bson:"_id"`
	Account    string    `bson:"account"`
	Platform   string    `bson:"platform"`
	Code       string    `bson:"code"`
	Duration   uint      `bson:"duration"`
	Count      int       `bson:"count"`
	Used       bool      `bson:"used"`
	CreateTime time.Time `bson:"create_time"`
}

func (VerifyCode) TableName

func (VerifyCode) TableName() string

type VerifyCodeInterface

type VerifyCodeInterface interface {
	Add(ctx context.Context, ms []*VerifyCode) error
	RangeNum(ctx context.Context, account string, start time.Time, end time.Time) (int64, error)
	TakeLast(ctx context.Context, account string) (*VerifyCode, error)
	Incr(ctx context.Context, id string) error
	Delete(ctx context.Context, id string) error
}

Jump to

Keyboard shortcuts

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