models

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func GetDB

func GetDB() *gorm.DB

func Login

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

Login logs in a user

Types

type Account

type Account struct {
	gorm.Model
	Email    string `json:"email"`
	Password string `json:"password"`
	Token    string `json:"token";sql:"-"`
}

Account a struct to rep user account

func GetUser

func GetUser(u uint) *Account

GetUser gets a user by specific ID

func (*Account) Create

func (account *Account) Create() map[string]interface{}

Create creates an user account with the given email and secret

func (*Account) Validate

func (account *Account) Validate() (map[string]interface{}, bool)

Validate incoming user details

type Token

type Token struct {
	UserId uint
	jwt.StandardClaims
}

JWT claims struct

Jump to

Keyboard shortcuts

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