models

package
v0.0.0-...-38e0e74 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(password string) ([]byte, error)

func UpdatePrice

func UpdatePrice(db *gorm.DB)

func VerifyPassword

func VerifyPassword(hashedPassword, password string) error

Types

type Price

type Price struct {
	ID        uint64    `gorm:"primary_key;auto_increment" json:"id"`
	BCToUSD   float64   `gorm:"not null" json:"bc_usd"`
	USDToBC   float64   `gorm:"not null" json:"usd_bc"`
	CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
	UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`
}

func (*Price) GetPrice

func (price *Price) GetPrice(db *gorm.DB) (*Price, error)

func (*Price) Prepare

func (price *Price) Prepare()

func (*Price) SavePrice

func (price *Price) SavePrice(db *gorm.DB) (*Price, error)

func (*Price) Validate

func (price *Price) Validate() error

type Transaction

type Transaction struct {
	ID        uint64    `gorm:"primary_key;auto_increment" json:"id"`
	Type      string    `gorm:"size:255;not null" json:"type"`
	BCValue   float64   `gorm:"not null" json:"bc_value"`
	USDValue  float64   `gorm:"not null" json:"usd_value"`
	OwnerID   uint32    `gorm:"nor null" json:"owner_id"`
	CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
	UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`
}

func (*Transaction) FindAllTransactions

func (transaction *Transaction) FindAllTransactions(db *gorm.DB) (*[]Transaction, error)

func (*Transaction) Prepare

func (transaction *Transaction) Prepare(db *gorm.DB) error

func (*Transaction) SaveTransaction

func (transaction *Transaction) SaveTransaction(db *gorm.DB) (*Transaction, error)

func (*Transaction) Validate

func (transaction *Transaction) Validate() error

type User

type User struct {
	ID         uint32    `gorm:"primary_key;auto_increment" json:"id"`
	Name       string    `gorm:"size:255;not null;unique" json:"name"`
	Email      string    `gorm:"size:255;not null;unique" json:"email"`
	BirthDate  time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"birth_date"`
	Password   string    `gorm:"size:100;not null;" json:"password`
	BCBalance  float64   `gorm:"default:0;not null" json:"bc_balance"`
	USDBalance float64   `gorm:"default:0;not null" json:"usd_balance"`
	CreatedAt  time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
	UpdatedAt  time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`
}

func (*User) BeforeSave

func (user *User) BeforeSave() error

func (*User) DeleteAUser

func (user *User) DeleteAUser(db *gorm.DB, uid uint32) (int64, error)

func (*User) FindAllUsers

func (user *User) FindAllUsers(db *gorm.DB) (*[]User, error)

func (*User) FindUserByID

func (user *User) FindUserByID(db *gorm.DB, uid uint32) (*User, error)

func (*User) Prepare

func (user *User) Prepare()

func (*User) SaveUser

func (user *User) SaveUser(db *gorm.DB) (*User, error)

func (*User) UpdateAUser

func (user *User) UpdateAUser(db *gorm.DB, uid uint32) (*User, error)

func (*User) Validate

func (user *User) Validate(action string) error

Jump to

Keyboard shortcuts

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