viewer

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockAggregation       = "blocks"
	TransactionAggregation = "transactions"
)

Variables

This section is empty.

Functions

func NewViewHandler

func NewViewHandler(t Transaction, b Block, o Overview) handler

Types

type Block

type Block interface {
	List(BlockArg) ([]models.Block, int64, error)
	Get(BlockArg) (models.Block, error)
}

func NewBlockHandler

func NewBlockHandler(db *pg.DB) Block

func NewBlockLoggerHandler

func NewBlockLoggerHandler() Block

type BlockArg

type BlockArg struct {
	From, Size         int
	Network            string
	StartTime, EndTime int64
	BlockNumber        uint64
	BlockHash          string
}

func (*BlockArg) ToCond

func (ba *BlockArg) ToCond() ([]string, []interface{})

type BySegFunc

type BySegFunc func(*pg.DB, string, int64, int64, int64) ([]BySegResp, error)

type BySegResp

type BySegResp struct {
	Start int64 `json:"start"`
	End   int64 `json:"end"`
	Count int64 `json:"count"`
}

func QueryBlocks

func QueryBlocks(db *pg.DB, network string, from, interval, number int64) ([]BySegResp, error)

QueryByBlocks from=0,interval=5,number=2 [-5,0),[0-5), [5-10)

func QueryTrnasactions

func QueryTrnasactions(db *pg.DB, network string, from, interval, number int64) ([]BySegResp, error)

type Count

type Count struct {
	Creator string `pg:"creator" json:"creator"`
	Count   int64  `pg:"count" json:"count"`
}

type Overview

type Overview interface {
	// Summary returns block height, number of transactions, number of nodes, total number of contracts.
	Summary(string) (SummaryResp, error)

	// QueryBySeg query the total number of transactions or blocks for a number of time periods
	// from, interval,number of time periods
	QueryBySeg(int64, int64, int64, string, string) ([]BySegResp, error)
}

func NewOverview

func NewOverview(db *pg.DB) Overview

func NewOverviewLogger

func NewOverviewLogger() Overview

type SummaryResp

type SummaryResp struct {
	BlockNumber uint64 `pg:"blockNumber" json:"blockNumber"`
	TxCount     uint64 `pg:"txCount" json:"txCount"`
}

type TransArg

type TransArg struct {
	From, Size         int
	NetworkName        string
	StartTime, EndTime int64
	Hash               string
	BlockNum           uint64
}

func (*TransArg) ToCond

func (ta *TransArg) ToCond() ([]string, []interface{})

type Transaction

type Transaction interface {
	// List : query transactions
	List(ta TransArg) ([]models.Transaction, int64, error)

	// Get : query transaction by transaction hash
	Get(ta TransArg) (*models.Transaction, error)

	// CountByOrg : count how many transactions are created by each organization
	CountByOrg(ta TransArg) ([]Count, error)
}

func NewTxHandler

func NewTxHandler(db *pg.DB) Transaction

type TxHandler

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

func (*TxHandler) CountByOrg

func (t *TxHandler) CountByOrg(ta TransArg) ([]Count, error)

func (*TxHandler) Get

func (t *TxHandler) Get(ta TransArg) (*models.Transaction, error)

func (*TxHandler) List

func (t *TxHandler) List(ta TransArg) ([]models.Transaction, int64, error)

Jump to

Keyboard shortcuts

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