models

package
v0.0.0-...-17b2fc0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(db *gorm.DB)

Migrate : migrate models

Types

type Post

type Post struct {
	gorm.Model
	ID uint64 `gorm:"primary_key"` // auto increment uint default true

	Title    string
	Content  string
	Username string
	Date     time.Time
}

Post : Post Model

type User

type User struct {
	gorm.Model
	Username     string
	PasswordHash string
	DisplayName  string
}

User : User Model

func (*User) GenerateToken

func (u *User) GenerateToken() (string, error)

GenerateToken : Generate Token

func (*User) HashPassword

func (u *User) HashPassword()

HashPassword : Hash Password

Jump to

Keyboard shortcuts

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