sqlstore

package
v0.0.0-...-1b653f5 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store object holds db instance

func New

func New(dbPath string, queryTimeout uint32) (*Store, error)

New creates new instance of the db and create needed tables

func (*Store) Close

func (s *Store) Close()

Close closes underlying db connection

func (*Store) DeleteAccount

func (s *Store) DeleteAccount(accId int64) error

DeleteAccount removes account from the accounts table

func (*Store) GetAccount

func (s *Store) GetAccount(accId int64) (models.Account, error)

GetAccount returns account model

func (*Store) GetTransactionsHistory

func (s *Store) GetTransactionsHistory(accountId, nLastdays, limit int64) ([]models.Transaction, error)

GetTransactionsHistory retunrs array of transcations for the requested period of time

func (*Store) InsertAccount

func (s *Store) InsertAccount(balance int64) (models.Account, error)

InsertAccount inserts new account into the accounts table and returns Account model

func (*Store) TransferMoney

func (s *Store) TransferMoney(accountToId, accountFromId, amount int64) error

TransferMoney transfers money from one account to another; writes transfer info into the transfers table

Jump to

Keyboard shortcuts

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