model

package
v0.0.0-...-f04d0a5 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = sqlx.ErrNotFound

Functions

This section is empty.

Types

type Admins

type Admins struct {
	Id        uint64    `db:"id"`         // 管�员ID
	UserId    uint64    `db:"user_id"`    // 用户ID
	CreatedAt time.Time `db:"created_at"` // 创建时间
}

type AdminsModel

type AdminsModel interface {
	// contains filtered or unexported methods
}

AdminsModel is an interface to be customized, add more methods here, and implement the added methods in customAdminsModel.

func NewAdminsModel

func NewAdminsModel(conn sqlx.SqlConn) AdminsModel

NewAdminsModel returns a model for the database table.

type LoginRecords

type LoginRecords struct {
	Id            uint64         `db:"id"`             // 记录ID
	UserId        uint64         `db:"user_id"`        // 用户ID
	LoginIp       string         `db:"login_ip"`       // 登录IP
	LoginLocation sql.NullString `db:"login_location"` // 登录地点
	DeviceType    sql.NullString `db:"device_type"`    // 设备类型
	CreatedAt     time.Time      `db:"created_at"`     // 创建时间
}

type LoginRecordsModel

type LoginRecordsModel interface {
	FindByUserId(ctx context.Context, userId uint64, limit int) ([]*LoginRecords, error)
	BatchInsert(ctx context.Context, records []*LoginRecords) error
	Trans(ctx context.Context, fn func(context context.Context, session sqlx.Session) error) error
	// contains filtered or unexported methods
}

LoginRecordsModel is an interface to be customized, add more methods here, and implement the added methods in customLoginRecordsModel.

func NewLoginRecordsModel

func NewLoginRecordsModel(conn sqlx.SqlConn) LoginRecordsModel

NewLoginRecordsModel returns a model for the database table.

type TransactionStats

type TransactionStats struct {
	TotalRecharge float64 `db:"total_recharge"`
	TotalSpent    float64 `db:"total_spent"`
	TotalRefund   float64 `db:"total_refund"`
}

type UserAddresses

type UserAddresses struct {
	Id            uint64    `db:"id"`             // 地�ID
	UserId        uint64    `db:"user_id"`        // 用户ID
	ReceiverName  string    `db:"receiver_name"`  // 收货人姓�
	ReceiverPhone string    `db:"receiver_phone"` // 收货人电�
	Province      string    `db:"province"`       // �份
	City          string    `db:"city"`           // 城市
	District      string    `db:"district"`       // 区/县
	DetailAddress string    `db:"detail_address"` // 详细地�
	IsDefault     int64     `db:"is_default"`     // 是�默认地�
	CreatedAt     time.Time `db:"created_at"`     // 创建时间
	UpdatedAt     time.Time `db:"updated_at"`     // 更新时间
}

type UserAddressesModel

type UserAddressesModel interface {
	WithSession(session sqlx.Session) UserAddressesModel
	FindByUserId(ctx context.Context, userId uint64) ([]*UserAddresses, error)
	SetDefault(ctx context.Context, userId, addressId uint64) error
	Trans(ctx context.Context, fn func(context context.Context, session sqlx.Session) error) error
	// contains filtered or unexported methods
}

func NewUserAddressesModel

func NewUserAddressesModel(conn sqlx.SqlConn) UserAddressesModel

type Users

type Users struct {
	Id          uint64         `db:"id"`           // 用户ID
	Username    string         `db:"username"`     // 用户�
	Password    string         `db:"password"`     // 密�
	Phone       sql.NullString `db:"phone"`        // 手机�
	Email       sql.NullString `db:"email"`        // 邮箱
	Nickname    sql.NullString `db:"nickname"`     // 昵称
	Avatar      sql.NullString `db:"avatar"`       // 头�URL
	Gender      string         `db:"gender"`       // 性别
	MemberLevel int64          `db:"member_level"` // 会员等级
	Status      int64          `db:"status"`       // 状� 0:�用 1:�用
	Online      int64          `db:"online"`       // 状� 0:离线 1:在线
	CreatedAt   time.Time      `db:"created_at"`   // 创建时间
	UpdatedAt   time.Time      `db:"updated_at"`   // 更新时间
}

type UsersModel

type UsersModel interface {
	WithSession(session sqlx.Session) UsersModel
	FindOneByPhoneOrEmail(ctx context.Context, account string) (*Users, error)
	UpdatePassword(ctx context.Context, id uint64, password string) error
	UpdateStatus(ctx context.Context, id uint64, status int32) error
	UpdateProfile(ctx context.Context, id uint64, nickname string, gender string) error
	UpdateOnline(ctx context.Context, id uint64, online int32) error
	Trans(ctx context.Context, fn func(context context.Context, session sqlx.Session) error) error
	// contains filtered or unexported methods
}

UsersModel is an interface to be customized, add more methods here, and implement the added methods in customUsersModel.

func NewUsersModel

func NewUsersModel(conn sqlx.SqlConn) UsersModel

NewUsersModel returns a model for the database table.

type WalletAccounts

type WalletAccounts struct {
	Id           uint64         `db:"id"`            // 钱包ID
	UserId       uint64         `db:"user_id"`       // 用户ID
	Balance      float64        `db:"balance"`       // 账户余�
	FrozenAmount float64        `db:"frozen_amount"` // 冻结金�
	PayPassword  sql.NullString `db:"pay_password"`  // 支付密�
	Status       int64          `db:"status"`        // 状� 0:冻结 1:正常
	CreatedAt    time.Time      `db:"created_at"`    // 创建时间
	UpdatedAt    time.Time      `db:"updated_at"`    // 更新时间
}

type WalletAccountsModel

type WalletAccountsModel interface {
	WithSession(session sqlx.Session) WalletAccountsModel
	UpdateBalance(ctx context.Context, userId uint64, amount float64) error
	FreezeAmount(ctx context.Context, userId uint64, amount float64) error
	UnfreezeAmount(ctx context.Context, userId uint64, amount float64) error
	UpdatePayPassword(ctx context.Context, userId uint64, password string) error
	DeleteByUserId(ctx context.Context, userId uint64) error
	Trans(ctx context.Context, fn func(context context.Context, session sqlx.Session) error) error
	// contains filtered or unexported methods
}

func NewWalletAccountsModel

func NewWalletAccountsModel(conn sqlx.SqlConn) WalletAccountsModel

type WalletTransactions

type WalletTransactions struct {
	Id        uint64         `db:"id"`         // 交易ID
	UserId    uint64         `db:"user_id"`    // 用户ID
	OrderId   string         `db:"order_id"`   // 订��
	Amount    float64        `db:"amount"`     // 交易金�
	Type      int64          `db:"type"`       // 交易类型 1:充值 2:�现 3:消费 4:退款
	Status    int64          `db:"status"`     // 交易状� 0:处�中 1:�功 2:失败
	Remark    sql.NullString `db:"remark"`     // 交易备注
	CreatedAt time.Time      `db:"created_at"` // 创建时间
	UpdatedAt time.Time      `db:"updated_at"` // 更新时间
}

type WalletTransactionsModel

type WalletTransactionsModel interface {
	WithSession(session sqlx.Session) WalletTransactionsModel
	FindByUserId(ctx context.Context, userId uint64, page, pageSize int) ([]*WalletTransactions, error)
	FindByType(ctx context.Context, userId uint64, transType int64) ([]*WalletTransactions, error)
	GetTransactionStats(ctx context.Context, tranId uint64) (*TransactionStats, error)
	UpdateState(ctx context.Context, status int64, tranId uint64) (int64, error)
	DeleteByUserId(ctx context.Context, userId uint64) error
	Trans(ctx context.Context, fn func(context context.Context, session sqlx.Session) error) error
	// contains filtered or unexported methods
}

func NewWalletTransactionsModel

func NewWalletTransactionsModel(conn sqlx.SqlConn) WalletTransactionsModel

Jump to

Keyboard shortcuts

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