dao

package
v0.0.0-...-d80f745 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dao

type Dao struct {
	UserDao *UserDao
	// contains filtered or unexported fields
}

func New

func New(c *config.Config, cache *redis.Redis) *Dao

type PassAndSalt

type PassAndSalt struct {
	Uid  uint64 `db:"uid"`
	Pass string `db:"pass"`
	Salt string `db:"salt"`
}

仅有部分查询结果的定义

type Timing

type Timing struct {
	CreateAt int64 `db:"create_at" json:"create_at,omitempty"`
	UpdateAt int64 `db:"update_at" json:"update_at,omitempty"`
}

type User

type User struct {
	UserBase
	UserSecret
}

type UserBase

type UserBase struct {
	Uid       uint64 `db:"uid" json:"uid"`
	Nickname  string `db:"nickname" json:"nickname"`
	Avatar    string `db:"avatar" json:"avatar"`
	StyleSign string `db:"style_sign" json:"style_sign"`
	Gender    int8   `db:"gender" json:"gender"`
	Tel       string `db:"tel" json:"tel"`
	Email     string `db:"email" json:"email"`
	Timing
}

type UserDao

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

func NewUserDao

func NewUserDao(db *xsql.DB, c *redis.Redis) *UserDao

func (*UserDao) CacheDelUserBaseByUid

func (d *UserDao) CacheDelUserBaseByUid(ctx context.Context, uid uint64) error

func (*UserDao) CacheGetUserBaseByUid

func (d *UserDao) CacheGetUserBaseByUid(ctx context.Context, uid uint64) (*UserBase, error)

func (*UserDao) CacheSetUserBase

func (d *UserDao) CacheSetUserBase(ctx context.Context, u *UserBase) error

func (*UserDao) Delete

func (d *UserDao) Delete(ctx context.Context, uid uint64) error

func (*UserDao) FindByTel

func (d *UserDao) FindByTel(ctx context.Context, tel string) (*User, error)

func (*UserDao) FindByUid

func (d *UserDao) FindByUid(ctx context.Context, uid uint64) (*User, error)

func (*UserDao) FindPassAndSaltByUid

func (d *UserDao) FindPassAndSaltByUid(ctx context.Context, uid uint64) (*PassAndSalt, error)

func (*UserDao) FindUserBaseByTel

func (d *UserDao) FindUserBaseByTel(ctx context.Context, tel string) (*UserBase, error)

func (*UserDao) FindUserBaseByUid

func (d *UserDao) FindUserBaseByUid(ctx context.Context, uid uint64) (*UserBase, error)

func (*UserDao) FindUserBaseByUids

func (d *UserDao) FindUserBaseByUids(ctx context.Context, uids []uint64) ([]*UserBase, error)

TODO make it cache

func (*UserDao) Insert

func (d *UserDao) Insert(ctx context.Context, user *User) error

func (*UserDao) UpdateAvatar

func (d *UserDao) UpdateAvatar(ctx context.Context, value string, uid uint64) error

func (*UserDao) UpdateEmail

func (d *UserDao) UpdateEmail(ctx context.Context, value string, uid uint64) error

func (*UserDao) UpdateGender

func (d *UserDao) UpdateGender(ctx context.Context, value int8, uid uint64) error

func (*UserDao) UpdateNickname

func (d *UserDao) UpdateNickname(ctx context.Context, value string, uid uint64) error

func (*UserDao) UpdatePass

func (d *UserDao) UpdatePass(ctx context.Context, value string, uid uint64) error

func (*UserDao) UpdateSalt

func (d *UserDao) UpdateSalt(ctx context.Context, value string, uid uint64) error

func (*UserDao) UpdateStyleSign

func (d *UserDao) UpdateStyleSign(ctx context.Context, value string, uid uint64) error

func (*UserDao) UpdateTel

func (d *UserDao) UpdateTel(ctx context.Context, value string, uid uint64) error

func (*UserDao) UpdateUserBase

func (d *UserDao) UpdateUserBase(ctx context.Context, base *UserBase) error

type UserSecret

type UserSecret struct {
	Pass string `db:"pass" json:"-"`
	Salt string `db:"salt" json:"-"`
}

Jump to

Keyboard shortcuts

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