driver

package
v0.0.0-...-c6d7a41 Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PgSQLInit

func PgSQLInit() (err error)

Init - initialisation of PgSQL driver. Connect to database, checking for existing of table On success Set module variables dbPool,dbContext,dbCancelFunc

Types

type PgSqlAccount

type PgSqlAccount struct {
	// contains filtered or unexported fields
}

func (*PgSqlAccount) Balance

func (pg *PgSqlAccount) Balance() float64

func (*PgSqlAccount) Create

func (pg *PgSqlAccount) Create(name string) error

Create - create a new account with name and load one in object this function not validate name Important! When any fields will be added into table, then need to add one in to INSERT query

func (*PgSqlAccount) Currency

func (pg *PgSqlAccount) Currency() string

func (*PgSqlAccount) Delete

func (pg *PgSqlAccount) Delete() error

Delete - delete wallet account

func (*PgSqlAccount) Deposit

func (pg *PgSqlAccount) Deposit(amount float64) (int64, error)

Deposit - add amount to account balance

func (*PgSqlAccount) Find

func (pg *PgSqlAccount) Find(name string) error

Find - find wallet with name and load in object

func (*PgSqlAccount) Get

func (pg *PgSqlAccount) Get(id int64) error

Get - get wallet by ID and load in object Important! When any fields will be added into table, then need to add one in to SELECT query

func (*PgSqlAccount) ID

func (pg *PgSqlAccount) ID() int64

func (*PgSqlAccount) List

func (pg *PgSqlAccount) List(offset, limit int64) ([]int64, error)

List - return list of all wallets account names Wallets listed ordering by id offset and limit are using for set slice bound of list if limit = -1, then no limit Important! When any fields will be added into table, then need to add one in to SELECT query

func (*PgSqlAccount) Name

func (pg *PgSqlAccount) Name() string

func (*PgSqlAccount) Transfer

func (pg *PgSqlAccount) Transfer(toID int64, amount float64) (int64, error)

Transfer - creating a payment form account to account with id "toID" function check that recipient are exists and that the account balance is sufficient

type PgSqlPayment

type PgSqlPayment struct {
	// contains filtered or unexported fields
}

func (PgSqlPayment) Amount

func (pg PgSqlPayment) Amount() float64

func (PgSqlPayment) Date

func (pg PgSqlPayment) Date() time.Time

func (PgSqlPayment) From

func (pg PgSqlPayment) From() int64

func (PgSqlPayment) Get

func (pg PgSqlPayment) Get(id int64) error

Get - get payment by ID and load in object Important! When any fields will be added into table, then need to add one in to SELECT query

func (PgSqlPayment) ID

func (pg PgSqlPayment) ID() int64

func (PgSqlPayment) List

func (pg PgSqlPayment) List(accountID, offset, limit int64) ([]interface{}, error)

List - return list of payments for account with accountID payments listed ordering by id offset and limit are using for set slice bound of list if limit = -1, then no limit Important! When any fields will be added into table, then need to add one in to SELECT query

func (PgSqlPayment) ListAll

func (pg PgSqlPayment) ListAll(offset, limit int64) ([]interface{}, error)

ListAll - return list of payments payments listed ordering by id offset and limit are using for set slice bound of list if limit = -1, then no limit Important! When any fields will be added into table, then need to add one in to SELECT query

func (PgSqlPayment) To

func (pg PgSqlPayment) To() int64

Jump to

Keyboard shortcuts

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