model

package
v0.0.0-...-d537b8a Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2020 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PassWordCost 密码加密难度
	PassWordCost = 12
)

Variables

View Source
var DB *gorm.DB

DB 数据库链接单例

Functions

func Init

func Init(connString string)

Init 在中间件中初始化mysql链接

Types

type Comment

type Comment struct {
	gorm.Model
	TopicID    uint
	ParentID   uint
	CreatorID  uint
	Content    string
	Permission uint
}

Comment 评论模型

type Picture

type Picture struct {
	gorm.Model
	Title      string
	Info       string
	CreatorID  uint
	Permission uint
	Key        string
}

Picture 图片模型

func (*Picture) SignGetURL

func (picture *Picture) SignGetURL() string

SignGetURL 返回签名影像URL

type User

type User struct {
	gorm.Model
	UserName       string
	PasswordDigest string
	CreatorID      string
}

User 用户模型

func GetUser

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

GetUser 用ID获取用户

func (*User) CheckPassword

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

CheckPassword 校验密码

func (*User) SetPassword

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

SetPassword 设置密码

Jump to

Keyboard shortcuts

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