model

package
v0.0.0-...-78a6345 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeRegister = iota
	CodeFindPassword
)

Variables

View Source
var (
	ErrNotFound = errors.New("not found")
)

Functions

This section is empty.

Types

type Model

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

func NewModel

func NewModel(driver, dsn string) (*Model, error)

func (*Model) CreateUser

func (m *Model) CreateUser(user *User) error

func (*Model) CreateVerifyCode

func (m *Model) CreateVerifyCode(vc *VerifyCode) error

func (*Model) GetUserByEmail

func (m *Model) GetUserByEmail(email string) (user *User, err error)

func (*Model) GetUserById

func (m *Model) GetUserById(id int) (user *User, err error)

func (*Model) GetUserByMobile

func (m *Model) GetUserByMobile(mobile string) (user *User, err error)

func (*Model) VerifyCode

func (m *Model) VerifyCode(vc *VerifyCode) bool

type User

type User struct {
	ID        int       `json:"id" xorm:"id pk autoincr"`
	Mobile    string    `json:"mobile" xorm:"mobile"`
	Email     string    `json:"email" xorm:"email"`
	Avatar    string    `json:"avatar" xorm:"avatar"`
	Password  string    `json:"-" xorm:"password"`
	AddVerify bool      `json:"add_verify" xorm:"add_verify"`
	CreateAt  time.Time `json:"create_at" xorm:"create_at"`
	DeleteAt  time.Time `json:"delete_at" xorm:"delete_at"`
}

func (User) TableName

func (u User) TableName() string

type VerifyCode

type VerifyCode struct {
	Id         int       `json:"id" xorm:"id pk autoincr"`
	Code       string    `json:"code" xorm:"code"`
	Info       string    `json:"info" xorm:"info"`
	Type       int       `json:"type" xorm:"type"`
	Verified   bool      `json:"verified" xorm:"verified"`
	CreateTime time.Time `json:"create_time" xorm:"create_time"`
}

func (VerifyCode) Table

func (VerifyCode) Table() string

Jump to

Keyboard shortcuts

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