models

package
v0.0.0-...-62f46d5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDB

func GetDB() *gorm.DB

GetDB ...

func Login

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

Login ...

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 ...

func (*Account) Create

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

Create ...

func (*Account) Validate

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

Validate incoming user details...

type Contact

type Contact struct {
	gorm.Model
	Name   string `json:"name"`
	Phone  string `json:"phone"`
	UserID uint   `json:"user_id"` //The user that this contact belongs to
}

Contact ...

func GetContact

func GetContact(id uint) *Contact

GetContact ...

func GetContacts

func GetContacts(user uint) []*Contact

GetContacts ...

func (*Contact) Create

func (contact *Contact) Create() map[string]interface{}

Create ...

func (*Contact) Validate

func (contact *Contact) Validate() (map[string]interface{}, bool)

Validate ...

type Token

type Token struct {
	UserID uint
	jwt.StandardClaims
}

Token JWT claims struct

Jump to

Keyboard shortcuts

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