models

package
v0.0.0-...-f894349 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: MIT Imports: 10 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, codevalid string) map[string]interface{}

func Update

func Update(email, password, username, userrole, codevalid string) map[string]interface{}

Функция func Update()обновления данных искомой записи по email в таблице account, кроме полей ID, email,token

Types

type Account

type Account struct {
	gorm.Model
	Email    string `json:"email"`
	Password string `json:"password"`
	Token    string `json:"token";sql:"-"`
	CodValid string `json:"codvalid"`
	UserName string `json:"username"`
	UserRole string `json:"userrole"`
}

a struct to rep user account

func GetUser

func GetUser(u uint) *Account

func GetUsers

func GetUsers() []*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...

func (*Account) ValidateUpdate

func (account *Account) ValidateUpdate() (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