db

package
v1.5.66-0...-d641260 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunMigrations

func RunMigrations(logger *common.Logger, pgConnectionString string, downFirst bool) error

Types

type BlockEvent

type BlockEvent struct {
	BlockID      int64
	Height       int64
	ChainID      string
	Type         string
	Key          pgtype.Text
	CompositeKey pgtype.Text
	Value        pgtype.Text
}

type CommitSlaNodeReportParams

type CommitSlaNodeReportParams struct {
	SlaRollupID    pgtype.Int4
	Address        string
	BlocksProposed int32
}

type CommitSlaRollupParams

type CommitSlaRollupParams struct {
	Time       pgtype.Timestamp
	TxHash     string
	BlockStart int64
	BlockEnd   int64
}

type CoreAppState

type CoreAppState struct {
	BlockHeight int64
	AppHash     []byte
	CreatedAt   pgtype.Timestamp
}

type CoreAttribute

type CoreAttribute struct {
	EventID      int64
	Key          string
	CompositeKey string
	Value        pgtype.Text
}

type CoreBlock

type CoreBlock struct {
	Rowid     int64
	Height    int64
	ChainID   string
	CreatedAt pgtype.Timestamptz
}

type CoreEvent

type CoreEvent struct {
	Rowid   int64
	BlockID int64
	TxID    pgtype.Int8
	Type    string
}

type CoreTxResult

type CoreTxResult struct {
	Rowid     int64
	BlockID   int64
	Index     int32
	CreatedAt pgtype.Timestamptz
	TxHash    string
	TxResult  []byte
}

type CoreTxStat

type CoreTxStat struct {
	ID          int32
	TxType      string
	TxHash      string
	BlockHeight int64
	CreatedAt   pgtype.Timestamp
}

type CoreValidator

type CoreValidator struct {
	Rowid        int32
	PubKey       string
	Endpoint     string
	EthAddress   string
	CometAddress string
	EthBlock     string
	NodeType     string
	SpID         string
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type EventAttribute

type EventAttribute struct {
	BlockID      int64
	TxID         pgtype.Int8
	Type         string
	Key          pgtype.Text
	CompositeKey pgtype.Text
	Value        pgtype.Text
}

type GetAppStateAtHeightRow

type GetAppStateAtHeightRow struct {
	BlockHeight int64
	AppHash     []byte
}

type GetLatestAppStateRow

type GetLatestAppStateRow struct {
	BlockHeight int64
	AppHash     []byte
}

type InsertRegisteredNodeParams

type InsertRegisteredNodeParams struct {
	PubKey       string
	Endpoint     string
	EthAddress   string
	CometAddress string
	EthBlock     string
	NodeType     string
	SpID         string
}

type InsertTxStatParams

type InsertTxStatParams struct {
	TxType      string
	TxHash      string
	BlockHeight int64
	CreatedAt   pgtype.Timestamp
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CheckDatabaseExists

func (q *Queries) CheckDatabaseExists(ctx context.Context, datname string) (bool, error)

func (*Queries) ClearUncommittedSlaNodeReports

func (q *Queries) ClearUncommittedSlaNodeReports(ctx context.Context) error

func (*Queries) CommitSlaNodeReport

func (q *Queries) CommitSlaNodeReport(ctx context.Context, arg CommitSlaNodeReportParams) error

func (*Queries) CommitSlaRollup

func (q *Queries) CommitSlaRollup(ctx context.Context, arg CommitSlaRollupParams) (int32, error)

func (*Queries) GetAllRegisteredNodes

func (q *Queries) GetAllRegisteredNodes(ctx context.Context) ([]CoreValidator, error)

func (*Queries) GetAppStateAtHeight

func (q *Queries) GetAppStateAtHeight(ctx context.Context, blockHeight int64) (GetAppStateAtHeightRow, error)

func (*Queries) GetBlock

func (q *Queries) GetBlock(ctx context.Context, height int64) (CoreBlock, error)

func (*Queries) GetBlockTransactions

func (q *Queries) GetBlockTransactions(ctx context.Context, blockID int64) ([]CoreTxResult, error)

func (*Queries) GetInProgressRollupReports

func (q *Queries) GetInProgressRollupReports(ctx context.Context) ([]SlaNodeReport, error)

func (*Queries) GetLatestAppState

func (q *Queries) GetLatestAppState(ctx context.Context) (GetLatestAppStateRow, error)

func (*Queries) GetLatestSlaRollup

func (q *Queries) GetLatestSlaRollup(ctx context.Context) (SlaRollup, error)

func (*Queries) GetNodeByEndpoint

func (q *Queries) GetNodeByEndpoint(ctx context.Context, endpoint string) (CoreValidator, error)

func (*Queries) GetRecentBlocks

func (q *Queries) GetRecentBlocks(ctx context.Context) ([]CoreBlock, error)

func (*Queries) GetRecentRollups

func (q *Queries) GetRecentRollups(ctx context.Context) ([]SlaRollup, error)

func (*Queries) GetRecentTxs

func (q *Queries) GetRecentTxs(ctx context.Context) ([]CoreTxResult, error)

func (*Queries) GetRegisteredNodeByCometAddress

func (q *Queries) GetRegisteredNodeByCometAddress(ctx context.Context, cometAddress string) (CoreValidator, error)

func (*Queries) GetRegisteredNodeByEthAddress

func (q *Queries) GetRegisteredNodeByEthAddress(ctx context.Context, ethAddress string) (CoreValidator, error)

func (*Queries) GetRegisteredNodesByType

func (q *Queries) GetRegisteredNodesByType(ctx context.Context, nodeType string) ([]CoreValidator, error)

func (*Queries) GetRollupReportsForId

func (q *Queries) GetRollupReportsForId(ctx context.Context, slaRollupID pgtype.Int4) ([]SlaNodeReport, error)

func (*Queries) GetSlaRollupWithId

func (q *Queries) GetSlaRollupWithId(ctx context.Context, id int32) (SlaRollup, error)

func (*Queries) GetTx

func (q *Queries) GetTx(ctx context.Context, lower string) (CoreTxResult, error)

func (*Queries) InsertRegisteredNode

func (q *Queries) InsertRegisteredNode(ctx context.Context, arg InsertRegisteredNodeParams) error

func (*Queries) InsertTxStat

func (q *Queries) InsertTxStat(ctx context.Context, arg InsertTxStatParams) error

func (*Queries) TotalBlocks

func (q *Queries) TotalBlocks(ctx context.Context) (int64, error)

func (*Queries) TotalTransactions

func (q *Queries) TotalTransactions(ctx context.Context) (int64, error)

func (*Queries) TotalTransactionsByType

func (q *Queries) TotalTransactionsByType(ctx context.Context, txType string) (int64, error)

func (*Queries) TotalTxResults

func (q *Queries) TotalTxResults(ctx context.Context) (int64, error)

func (*Queries) TotalValidators

func (q *Queries) TotalValidators(ctx context.Context) (int64, error)

func (*Queries) TxsPerHour

func (q *Queries) TxsPerHour(ctx context.Context) ([]TxsPerHourRow, error)

func (*Queries) UpsertAppState

func (q *Queries) UpsertAppState(ctx context.Context, arg UpsertAppStateParams) error

func (*Queries) UpsertSlaRollupReport

func (q *Queries) UpsertSlaRollupReport(ctx context.Context, address string) error

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

type SlaNodeReport

type SlaNodeReport struct {
	ID             int32
	Address        string
	BlocksProposed int32
	SlaRollupID    pgtype.Int4
}

type SlaRollup

type SlaRollup struct {
	ID         int32
	TxHash     string
	BlockStart int64
	BlockEnd   int64
	Time       pgtype.Timestamp
}

type TxEvent

type TxEvent struct {
	Height       int64
	Index        int32
	ChainID      string
	Type         string
	Key          pgtype.Text
	CompositeKey pgtype.Text
	Value        pgtype.Text
	CreatedAt    pgtype.Timestamptz
}

type TxsPerHourRow

type TxsPerHourRow struct {
	Hour    pgtype.Timestamp
	TxType  string
	TxCount int64
}

type UpsertAppStateParams

type UpsertAppStateParams struct {
	BlockHeight int64
	AppHash     []byte
}

Jump to

Keyboard shortcuts

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