Documentation ¶
Index ¶
- func Hash(secret string) ([]byte, error)
- func SanitizeAccounts(accounts *[]Account)
- func SanitizeTransferAccounts(transfers *[]Transfer)
- func VerifySecret(hashedSecret, secret string) error
- type Account
- func (a *Account) BeforeSave() error
- func (a *Account) DepositOnBalance(db *gorm.DB, amount float64) error
- func (a *Account) FindAccountBalanceByID(db *gorm.DB, id uint64) (*Balance, error)
- func (a *Account) FindAccountByCPF(db *gorm.DB, cpf string) (*Account, error)
- func (a *Account) FindAccountByID(db *gorm.DB, id uint64) (*Account, error)
- func (a *Account) FindAllAccounts(db *gorm.DB) (*[]Account, error)
- func (a *Account) Prepare()
- func (a *Account) SanitizeAccount()
- func (a *Account) SaveAccount(db *gorm.DB) (*Account, error)
- func (a *Account) UpdateBalance(db *gorm.DB, balance float64) error
- func (a *Account) Validate(action string) error
- func (a *Account) ValidateCPF() error
- func (a *Account) ValidateName() error
- func (a *Account) ValidateSecret() error
- func (a *Account) ValidateUniqueCPF(db *gorm.DB) error
- func (a *Account) WithdrawFromBalance(db *gorm.DB, amount float64) error
- type Balance
- type Transfer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SanitizeAccounts ¶
func SanitizeAccounts(accounts *[]Account)
func SanitizeTransferAccounts ¶
func SanitizeTransferAccounts(transfers *[]Transfer)
func VerifySecret ¶
Types ¶
type Account ¶
type Account struct { ID uint64 `gorm:"primary_key;auto_increment" json:"id"` Name string `gorm:"size:255;not null;" json:"name"` CPF string `gorm:"size:11; not null;unique" json:"cpf"` Secret string `gorm:"size:100;not null;" json:"secret"` Balance float64 `gorm:"default:0; not null" json:"balance"` CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"` }
func (*Account) BeforeSave ¶
func (*Account) DepositOnBalance ¶
func (*Account) FindAccountBalanceByID ¶
func (*Account) FindAccountByCPF ¶
func (*Account) FindAccountByID ¶
func (*Account) FindAllAccounts ¶
func (*Account) SanitizeAccount ¶
func (a *Account) SanitizeAccount()
func (*Account) ValidateCPF ¶
func (*Account) ValidateName ¶
func (*Account) ValidateSecret ¶
type Transfer ¶
type Transfer struct { ID uint64 `gorm:"primary_key;auto_increment" json:"id"` Account_origin_id uint64 `gorm:"not null" json:"account_origin_id"` Account_origin Account `gorm:"foreignkey:Account_origin_id"` Account_destination_id uint64 `gorm:"not null" json:"account_destination_id"` Account_destination Account `gorm:"foreignkey:Account_destination_id"` Amount float64 `gorm:"default:0; not null" json:"amount"` CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"` }
func (*Transfer) FindAllTransfersById ¶
Click to show internal directories.
Click to hide internal directories.