stores

package
v0.0.0-...-8ab94dc Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

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

func NewFactory

func NewFactory(db *gorm.DB) *Factory

func (*Factory) NewUserStore

func (factory *Factory) NewUserStore() *UserStore

NewUserStore 返回一个新的 UserStore 实例。

返回值:

  • *UserStore:新的 UserStore 实例。

type UserStore

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

UserStore 用户信息数据库

func (*UserStore) BanToken

func (store *UserStore) BanToken(token string, claims *types.BearerTokenClaims) error

BanToken 将用户 Token 加入黑名单。

参数:

  • token:Token
  • claims:Token 中的声明

返回值:

  • error:如果在插入过程中发生错误,则返回相应的错误信息,否则返回nil。

func (*UserStore) CreateUserLoginLog

func (store *UserStore) CreateUserLoginLog(userLoginLogInfo *models.UserLoginLog) error

InsertUserLoginLog 插入用户登录日志。

参数:

  • userLoginLogInfo:用户登录日志信息

返回值:

  • error:如果在插入过程中发生错误,则返回相应的错误信息,否则返回nil。

func (*UserStore) GetUserAuthInfo

func (store *UserStore) GetUserAuthInfo(username string) (*models.UserAuthInfo, error)

GetUserAuthInfo 通过用户名获取用户的认证信息。

参数:

  • username:用户名

返回值:

  • *models.UserAuthInfo:如果找到了相应的用户认证信息,则返回该用户认证信息,否则返回nil。
  • error:如果在获取过程中发生错误,则返回相应的错误信息,否则返回nil。

func (*UserStore) GetUserByUID

func (store *UserStore) GetUserByUID(uid uint64) (*models.UserInfo, error)

GetUserByUID 通过用户ID获取用户信息。

参数:

  • uid:用户ID

返回值:

  • *models.UserInfo:如果找到了相应的用户信息,则返回该用户信息,否则返回nil。
  • error:如果在获取过程中发生错误,则返回相应的错误信息,否则返回nil。

func (*UserStore) GetUserByUsername

func (store *UserStore) GetUserByUsername(username string) (*models.UserInfo, error)

GetUserByUsername 通过用户名获取用户信息。

参数:

  • username:用户名

返回值:

  • *models.UserInfo:如果找到了相应的用户信息,则返回该用户信息,否则返回nil。
  • error:如果在获取过程中发生错误,则返回相应的错误信息,否则返回nil。

func (*UserStore) RegisterUser

func (store *UserStore) RegisterUser(username string, salt string, hashedPassword string) error

RegisterUser 注册用户将提供的用户名、盐和哈希密码注册到数据库中。

参数:

  • username:用户名
  • salt:盐值
  • hashedPassword:哈希密码

返回值:

  • error:如果在注册过程中发生错误,则返回相应的错误信息,否则返回nil。

Jump to

Keyboard shortcuts

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