store

package
v0.0.0-...-3fff15a Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Number       int64          `sql:",pk"`
	Transactions []*Transaction `sql:",fk:block_number"`
	BlockTime    time.Time
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

type Store

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

func NewStore

func NewStore(db *pg.DB, v *viper.Viper) (*Store, error)

func (*Store) Confirms

func (s *Store) Confirms() int64

Confirms is last confirmed block

func (*Store) FetchTransactions

func (s *Store) FetchTransactions() (result []*Transaction, err error)

FetchTransactions to response

func (*Store) LastBlock

func (s *Store) LastBlock() int64

LastBlock in store

func (*Store) SaveBlock

func (s *Store) SaveBlock(bl *Block) error

SaveBlock to store

func (*Store) SaveTransaction

func (s *Store) SaveTransaction(tx *Transaction) error

SaveTransaction to store

func (*Store) SetBlock

func (s *Store) SetBlock(v int64)

SetBlock current block number

func (*Store) UpdateSeen

func (s *Store) UpdateSeen(txs []*Transaction) error

UpdateSeen for transactions

type Transaction

type Transaction struct {
	Hash        string `sql:",pk"`
	From        string
	To          string
	Seen        bool
	BlockNumber int64
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

Jump to

Keyboard shortcuts

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