mysql

package
v0.0.0-...-c61ee60 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type User

type User struct {
	ID         int64  `gorm:"primarykey"`
	Username   string `gorm:"type:varchar(40)"`
	Password   string `gorm:"type:varchar(40)"`
	ArticleNum int64
}

func (*User) BeforeCreate

func (u *User) BeforeCreate(_ *gorm.DB) (err error)

BeforeCreate uses snowflake to generate an ID.

type UserManager

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

func NewUserManager

func NewUserManager(db *gorm.DB) *UserManager

NewUserManager creates a mysql manager.

func (*UserManager) ArticleNumPlusOne

func (m *UserManager) ArticleNumPlusOne(uid int64) error

func (*UserManager) CreateUser

func (m *UserManager) CreateUser(username, password string) error

func (*UserManager) GetArticleNum

func (m *UserManager) GetArticleNum(uid int64) (int64, error)

func (*UserManager) GetUserById

func (m *UserManager) GetUserById(uid int64) (*User, error)

func (*UserManager) GetUserByName

func (m *UserManager) GetUserByName(name string) (*User, error)

func (*UserManager) LoginCheck

func (m *UserManager) LoginCheck(username, password string) (bool, int64, error)

Jump to

Keyboard shortcuts

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