Documentation ¶
Index ¶
- type BoltStore
- func (s *BoltStore) AddTransaction(t *Transaction) error
- func (s *BoltStore) DeleteTransaction(t *Transaction) error
- func (s *BoltStore) GetTransactions() ([]*Transaction, error)
- func (s *BoltStore) GetTransactionsTemp() ([]*Transaction, error)
- func (s *BoltStore) Start() error
- func (s *BoltStore) Stop()
- func (s *BoltStore) UpdateTransaction(t *Transaction) error
- type IStore
- type Transaction
- type TransactionType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoltStore ¶
type BoltStore struct { DatabaseFile string // contains filtered or unexported fields }
BoltStore implements the IStore and uses BoltDB for storage of transactions
func NewBoltStore ¶
NewBoltStore creates a new store object
func (*BoltStore) AddTransaction ¶
func (s *BoltStore) AddTransaction(t *Transaction) error
AddTransaction adds a transaction to the bolt database
func (*BoltStore) DeleteTransaction ¶
func (s *BoltStore) DeleteTransaction(t *Transaction) error
DeleteTransaction deletes a transaction from the bolt database
func (*BoltStore) GetTransactions ¶
func (s *BoltStore) GetTransactions() ([]*Transaction, error)
GetTransactions returns all transactions from the bolt database
func (*BoltStore) GetTransactionsTemp ¶
func (s *BoltStore) GetTransactionsTemp() ([]*Transaction, error)
GetTransactionsTemp will replace GetTransactions when bolt implementation is done
func (*BoltStore) UpdateTransaction ¶
func (s *BoltStore) UpdateTransaction(t *Transaction) error
UpdateTransaction updates a transaction in the database
type IStore ¶
type IStore interface { Start() error Stop() GetTransactions() ([]*Transaction, error) AddTransaction(t *Transaction) error UpdateTransaction(t *Transaction) error DeleteTransaction(t *Transaction) error }
IStore defines the operations a store must implement
type Transaction ¶
type Transaction struct { ID int `json:"id"` Type TransactionType `json:"type"` CoinID string `json:"coinId"` CoinAmount float64 `json:"coinAmount"` DateTime int64 `json:"dateTime"` PriceUSD float64 `json:"priceUsd"` Hide bool `json:"hide"` }
Transaction describes a but or sell transaction
type TransactionType ¶
type TransactionType int
TransactionType is the type of transaction: buy or sell
const ( TransactionBuy TransactionType = iota TransactionSell )
TransactionType enumeration
Click to show internal directories.
Click to hide internal directories.