models

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCacheClient

func NewCacheClient(cacheSetting *setting.CacheSettingS) (*redis.Client, error)

func NewDBEngine

func NewDBEngine(databaseSetting *setting.DatabaseSettingS) (*gorm.DB, error)

Types

type CommonModel

type CommonModel struct {
	ID    uint32 `gorm:"primary_key" json:"id,omitempty"`
	Ctime uint32 `json:"ctime,omitempty"`
	Mtime uint32 `json:"mtime,omitempty"`
}

type UserSessionTab

type UserSessionTab struct {
	*CommonModel
	SessionID  string `json:"session_id"`  // 用户SessionID
	UserID     uint32 `json:"user_id"`     // 用户ID
	ExpireTime uint32 `json:"expire_time"` // 用户Session失效时间
}

func (UserSessionTab) TableName

func (us UserSessionTab) TableName() string

type UserTab

type UserTab struct {
	*CommonModel
	Name       string `json:"name"`        // 用户名
	Nickname   string `json:"nickname"`    // 用户昵称
	ProfilePic string `json:"profile_pic"` // 用户头像路径
	Password   string `json:"password"`    // 用户登陆密码(加盐)
	Status     uint8  `json:"status"`      // 用户状态 0-enabled 1-disabled
}

func (UserTab) Create

func (u UserTab) Create(db *gorm.DB) (*UserTab, error)

func (UserTab) GetUserByName

func (u UserTab) GetUserByName(db *gorm.DB) (UserTab, error)

func (UserTab) TableName

func (u UserTab) TableName() string

func (UserTab) Update

func (u UserTab) Update(db *gorm.DB, values interface{}) error

Jump to

Keyboard shortcuts

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