model

package
v0.0.0-...-d27c886 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connection

func Connection(databaseUrl string) (err error)

Types

type Note

type Note struct {
	gorm.Model `json:"-"`
	Title      string
	Content    string `gorm:"type:text"`
	PreView    string `gorm:"type:varchar(255)"`
	AuthorID   uint
}

func (*Note) CreateNote

func (note *Note) CreateNote() error

func (*Note) GetNote

func (note *Note) GetNote() error

func (*Note) GetNoteList

func (note *Note) GetNoteList(page int, num int) ([]getNoteListResult, error)

返回最新Note的list

type User

type User struct {
	gorm.Model `json:"-"`
	Email      string `gorm:"type:varchar(64);unique_index;not null"`
	Name       string `gorm:"type:varchar(64);unique;not null"`
	Password   string `gorm:"type:varchar(64);not null"`
}

func (*User) CheckToken

func (user *User) CheckToken(token string) bool

func (*User) CreateToken

func (user *User) CreateToken() (string, error)

func (*User) CreateUser

func (user *User) CreateUser() error

func (*User) GetUser

func (user *User) GetUser() error

func (*User) GetUserNameById

func (user *User) GetUserNameById(id uint) string

func (*User) Verification

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

Jump to

Keyboard shortcuts

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