models

package
v0.0.0-...-c7cd4ea Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2019 License: MIT Imports: 14 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{}

func RecoverPassword

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

Types

type BTC

type BTC struct {
	Price       float64   `json:"price"`
	LastUpdated time.Time `json:"last_updated"`
}

type Bitcoin

type Bitcoin struct {
	gorm.Model
	Value      float64   `gorm:"not null"`
	LastUpdate time.Time `gorm:"not null;type:timestamp"`
}

func (*Bitcoin) GetValueBTC

func (bitcoin *Bitcoin) GetValueBTC(option int) *Bitcoin

type CoinMarket

type CoinMarket struct {
	Status *Status `json:"status"`
	Data   *Data   `json:"data"`
}

type Data

type Data struct {
	ID          int       `json:"id"`
	Symbol      string    `json:"symbol"`
	Name        string    `json:"name"`
	Amount      int       `json:"amount"`
	LastUpdated time.Time `json:"last_updated"`
	Quote       *Quote    `json:"quote"`
}

type Operation

type Operation struct {
	gorm.Model
	Qty    float64   `gorm:"not null" json:"qty"`
	Date   time.Time `gorm:"type:timestamp;not null" json:"date"`
	Value  float64   `gorm:"not null" json:"value"`
	Type   uint      `gorm:"not null" json:"type"` // 0 - compra ; 1 - venda
	UserID uint      `gorm:"not null" json:"user_id"`
}

func GetOperationByDate

func GetOperationByDate(date string) (map[string]interface{}, []*Operation)

func GetOperationByUser

func GetOperationByUser(id uint64) (map[string]interface{}, []*Operation)

func (*Operation) Create

func (operation *Operation) Create() map[string]interface{}

func (*Operation) Validate

func (operation *Operation) Validate() (map[string]interface{}, bool)

type Quote

type Quote struct {
	Btc *BTC `json:"BTC"`
}

type Status

type Status struct {
	Timestamp    time.Time   `json:"timestamp"`
	ErrorCode    int         `json:"error_code"`
	ErrorMessage interface{} `json:"error_message"`
	Elapsed      int         `json:"elapsed"`
	CreditCount  int         `json:"credit_count"`
}

type Token

type Token struct {
	UserId uint
	jwt.StandardClaims
}

type User

type User struct {
	gorm.Model
	Email    string `gorm:"unique_index;not null" json:"email"`
	Password string `gorm:"not null" json:"password"`
	Name     string `gorm:"not null" json:"name"`
	Birthday string `gorm:"not null" json:"birthday"`
	Token    string `json:"token"; sql:"-"`
}

func GetUser

func GetUser(email string) *User

func (*User) Create

func (user *User) Create() map[string]interface{}

func (*User) Validate

func (user *User) Validate() (map[string]interface{}, bool)

Jump to

Keyboard shortcuts

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