store

package
v0.0.0-...-d1f1add Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2018 License: GPL-3.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DbCosmosTxn   = "cosmos_txn"
	TbNmCoinTx    = "coin_tx"
	TbNmStakeTx   = "stake_tx"
	TbNmSyncBlock = "sync_block"
	PageSize      = 10
)

Variables

View Source
var Mgo = MgoBackend{}

Functions

This section is empty.

Types

type CoinTx

type CoinTx struct {
	TxHash string     `json:"tx_hash"`
	Time   time.Time  `json:"time"`
	Height int64      `json:"height"`
	From   string     `json:"from"`
	To     string     `json:"to"`
	Amount coin.Coins `json:"coins"`
}

func (CoinTx) KvPair

func (c CoinTx) KvPair() (string, string)

func (CoinTx) TbNm

func (c CoinTx) TbNm() string

type MgoBackend

type MgoBackend struct {
	Session *mgo.Session
}

func (*MgoBackend) Init

func (m *MgoBackend) Init(url string)

func (*MgoBackend) QueryCoinTxs

func (m *MgoBackend) QueryCoinTxs() []CoinTx

func (*MgoBackend) QueryCoinTxsByAccount

func (m *MgoBackend) QueryCoinTxsByAccount(account string) []CoinTx

func (*MgoBackend) QueryCoinTxsByFrom

func (m *MgoBackend) QueryCoinTxsByFrom(from string) []CoinTx

func (*MgoBackend) QueryLastedBlock

func (m *MgoBackend) QueryLastedBlock() (SyncBlock, error)

func (*MgoBackend) QueryPageCoinTxsByFrom

func (m *MgoBackend) QueryPageCoinTxsByFrom(from string, page int) []CoinTx

func (*MgoBackend) QueryStakeTxs

func (m *MgoBackend) QueryStakeTxs() []StakeTx

func (*MgoBackend) QueryStakeTxsByAccount

func (m *MgoBackend) QueryStakeTxsByAccount(account string) []StakeTx

func (*MgoBackend) Save

func (m *MgoBackend) Save(tx TxHander) error

func (*MgoBackend) UpdateBlock

func (m *MgoBackend) UpdateBlock(b SyncBlock) error

type StakeTx

type StakeTx struct {
	TxHash string    `json:"tx_hash"`
	Time   time.Time `json:"time"`
	Height int64     `json:"height"`
	From   string    `json:"from"`
	Type   string    `json:"type"`
	Amount coin.Coin `json:"amount"`
}

func (StakeTx) KvPair

func (c StakeTx) KvPair() (string, string)

func (StakeTx) TbNm

func (c StakeTx) TbNm() string

type SyncBlock

type SyncBlock struct {
	CurrentPos    int64 `json:"current_pos"`
	TotalCoinTxs  int64 `json:"total_coin_txs"`
	TotalStakeTxs int64 `json:"total_stake_txs"`
}

func (SyncBlock) KvPair

func (c SyncBlock) KvPair() (string, string)

func (SyncBlock) TbNm

func (c SyncBlock) TbNm() string

type TxHander

type TxHander interface {
	TbNm() string
	KvPair() (string, string)
}

Jump to

Keyboard shortcuts

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