Documentation ¶
Index ¶
- Constants
- Variables
- func EncodeKey(key interface{}, typeName string) ([]byte, error)
- func JSONDecode(data []byte, value interface{}) error
- func JSONEncode(value interface{}) ([]byte, error)
- func NewDepositRepositoryImpl(store *badgerhold.Store) domain.DepositRepository
- func NewMarketRepositoryImpl(store, priceStore *badgerhold.Store) domain.MarketRepository
- func NewRepoManager(baseDbDir string, logger badger.Logger) (ports.RepoManager, error)
- func NewTradeRepositoryImpl(store *badgerhold.Store) domain.TradeRepository
- func NewUnspentRepositoryImpl(store, lockStore *badgerhold.Store) domain.UnspentRepository
- func NewVaultRepositoryImpl(store *badgerhold.Store) domain.VaultRepository
- func NewWithdrawalRepositoryImpl(store *badgerhold.Store) domain.WithdrawalRepository
- type LockedUnspent
Constants ¶
const ( UnspentBadgerholdKeyPrefix = "bh_Unspent" LockedUnspentBadgerholdKeyPrefix = "bh_LockedUnspent" )
const (
TradeBadgerholdKeyPrefix = "bh_Trade"
)
Variables ¶
var ( // ErrMarketInvalidRequest ... ErrMarketInvalidRequest = errors.New("requested market is null") // ErrMarketNotFound ... ErrMarketNotFound = errors.New("market not found") )
var ( // ErrTradeNotFound ... ErrTradeNotFound = errors.New("trade not found") )
var ( // ErrVaultNotFound ... ErrVaultNotFound = errors.New("vault not found") )
Functions ¶
func EncodeKey ¶
EncodeKey encodes key values with a type prefix which allows multiple different types to exist in the badger DB
func JSONDecode ¶
JSONDecode is a custom JSON based decoder for badger
func JSONEncode ¶
JSONEncode is a custom JSON based encoder for badger
func NewDepositRepositoryImpl ¶ added in v0.6.0
func NewDepositRepositoryImpl(store *badgerhold.Store) domain.DepositRepository
NewDepositRepositoryImpl initialize a badger implementation of the domain.StatsRepository
func NewMarketRepositoryImpl ¶
func NewMarketRepositoryImpl(store, priceStore *badgerhold.Store) domain.MarketRepository
NewMarketRepositoryImpl initialize a badger implementation of the domain.MarketRepository
func NewRepoManager ¶ added in v0.3.1
func NewRepoManager(baseDbDir string, logger badger.Logger) (ports.RepoManager, error)
NewRepoManager opens (or creates if not exists) the badger store on disk. It expects a base data dir and an optional logger. It creates a dedicated directory for main and prices stores, while the unspent repository lives in memory.
func NewTradeRepositoryImpl ¶
func NewTradeRepositoryImpl(store *badgerhold.Store) domain.TradeRepository
func NewUnspentRepositoryImpl ¶
func NewUnspentRepositoryImpl(store, lockStore *badgerhold.Store) domain.UnspentRepository
func NewVaultRepositoryImpl ¶
func NewVaultRepositoryImpl(store *badgerhold.Store) domain.VaultRepository
func NewWithdrawalRepositoryImpl ¶ added in v0.6.0
func NewWithdrawalRepositoryImpl(store *badgerhold.Store) domain.WithdrawalRepository
NewWithdrawalRepositoryImpl initialize a badger implementation of the domain.StatsRepository