models

package
v0.0.0-...-07d666e Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2020 License: Unlicense Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDB

func GetDB() *gorm.DB

func Login

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

Types

type Account

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

a struct to rep user account

func GetUser

func GetUser(u uint) *Account

func (*Account) Create

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

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
}

func GetContact

func GetContact(id uint) *Contact

func GetContacts

func GetContacts(user uint) []*Contact

func (*Contact) Create

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

func (*Contact) Validate

func (contact *Contact) Validate() (map[string]interface{}, bool)
This struct function validate the required parameters sent through the http request body

returns message and true if the requirement is met

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