models

package
v0.0.0-...-ad296c0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2019 License: MIT Imports: 7 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 represent a 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 Note

type Note struct {
	gorm.Model
	Name   string `json:"name"`
	Note   string `json:"note"`
	UserId uint   `json:"user_id"` //The user that this note belongs to
}

func GetNote

func GetNote(id uint) *Note

func GetNotes

func GetNotes(user uint) []*Note

func (*Note) Create

func (note *Note) Create() map[string]interface{}

func (*Note) Validate

func (note *Note) 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