model

package
v0.0.0-...-e520e56 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComparePasswordHash

func ComparePasswordHash(hashedPassword, givenPassword []byte) bool

func GeneratePasswordHash

func GeneratePasswordHash(password []byte) ([]byte, error)

Types

type Id

type Id []byte

func NewId

func NewId() Id

type Model

type Model struct {
	ID        uint       `gorm:"primary_key" json:"id"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	DeletedAt *time.Time `sql:"index" json:"deleted_at"`
}

type Todo

type Todo struct {
	Model

	Name string `json:"name"`
	Done bool   `json:"done"`

	User   User `json:"-"`
	UserID uint `json:"-"`
}

type User

type User struct {
	Model

	Email          string
	HashedPassword []byte
}

func (*User) CheckPassword

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

func (*User) SetPassword

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

Jump to

Keyboard shortcuts

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