models

package
v0.0.0-...-35ff541 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DB

func DB() *gorm.DB

func Login

func Login(email, psw string) map[string]interface{}

func SetResetPasswordToken

func SetResetPasswordToken(email string) (map[string]interface{}, bool)

SetResetPasswordToken ...

Types

type JwtToken

type JwtToken struct {
	jwt.StandardClaims
	UserID uint
}

JwtToken ...

type PasswordReset

type PasswordReset struct {
	TokenReset  string `json:"token_reset"`
	NewPassword string `json:"new_password"`
}

type User

type User struct {
	gorm.Model
	Email             string    `json:"email"`
	Password          string    `json:"password"`
	Token             string    `json:"token";sql:"-"`
	TokenReset        string    `json:"tokenReset";sql:"-"`
	TokenResetExpires time.Time `json:"tokenResetTime"`
}

User model

func Find

func Find(id uint) *User

Find user by id

func (*User) Create

func (user *User) Create() map[string]interface{}

Create creates new user

func (*User) Validate

func (user *User) Validate() (map[string]interface{}, bool)

Validate validates user data when attempting to create an account

Jump to

Keyboard shortcuts

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