model

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package model Time : 2023/9/24 16:17 Author : xushiyin contact : yuqingxushiyin@gmail.com

Package model Time : 2023/9/24 17:07 Author : xushiyin contact : yuqingxushiyin@gmail.com

Package model Time : 2023/9/24 17:07 Author : xushiyin contact : yuqingxushiyin@gmail.com

Index

Constants

View Source
const (
	// PassWordCost
	PassWordCost = 12
	// Active user
	Active string = "active"
	// Inactive user
	Inactive string = "inactive"
	// Suspend user
	Suspend string = "suspend"
)

Variables

View Source
var DB *gorm.DB

DB database singleton

Functions

func Database

func Database(connStr string) error

Database init database instance

Types

type User

type User struct {
	gorm.Model
	UserName       string
	PasswordDigest string
	Nickname       string
	Status         string
	Avatar         string `gorm:"size:1000"`
}

User 用户模型

func GetUser

func GetUser(ID interface{}) (User, error)

GetUser get user id

func (*User) CheckPassword

func (user *User) CheckPassword(password string) bool

CheckPassword validate password

func (*User) SetPassword

func (user *User) SetPassword(password string) error

SetPassword set password

Jump to

Keyboard shortcuts

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