models

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

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

Go to latest
Published: Nov 21, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddUser

func AddUser(username string, password string, telephone string) error

添加一个用户

func CheckLogin

func CheckLogin(username string, password string) (bool, error)

判断用户能否登录

func CloseDB

func CloseDB()

func ExistUserByName

func ExistUserByName(name string) (bool, error)

用户名是否可用

1.查询用户名是否重复

func IsTelephoneUsable

func IsTelephoneUsable(phone string) int

电话号码是否可用

1.电话号码是否符合规则
2.是否存在相同的电话号码

func ResetPassword

func ResetPassword(telephone string, password string) error

重置密码

func Setup

func Setup()

初始化数据库实例

Types

type Model

type Model struct {
	ID         int `gorm:"primary_key" json:"id"`
	CreatedOn  int `json:"created_on"`
	ModifiedOn int `json:"modified_on"`
	DeletedOn  int `json:"deleted_on"`
}

type User

type User struct {
	ID        int    `gorm:"primary_key" json:"id"`
	Username  string `json:"username"`
	Password  string `json:"password"`
	Telephone string `json:"telephone"`
	Email     string `json:"email"`
}

Jump to

Keyboard shortcuts

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