database

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDBInstance

func NewDBInstance(dbConf config.DatabaseConfig) (*gorm.DB, error)

func NewDBInstanceCopy

func NewDBInstanceCopy(dbInst *gorm.DB) (*gorm.DB, error)

func SqlCreateTableEventOrphan added in v0.0.2

func SqlCreateTableEventOrphan(tableName string) string

func SqlCreateTableRevision

func SqlCreateTableRevision(tableName string) string

func SqlCreateTableSnapshotData

func SqlCreateTableSnapshotData(tableName string) string

func SqlCreateTableSnapshotSync

func SqlCreateTableSnapshotSync(tableName string) string

func SqlCreateTableState

func SqlCreateTableState(tableName string) string

func SqlInsertOrphanEvent added in v0.0.2

func SqlInsertOrphanEvent(tableName string, orphanEvent ...TableEventOrphan) string

func SqlInsertRevision

func SqlInsertRevision(tableName string, revision ...TableRevision) string

func SqlInsertSnapshotData

func SqlInsertSnapshotData(tableName string, snapshotData ...TableSnapshotData) string

func SqlInsertSnapshotSync

func SqlInsertSnapshotSync(tableName string, snapshotSync ...TableSnapshotSync) string

func SqlInsertState

func SqlInsertState(tableName string, state ...TableState) string

func TryExecPipelineSql

func TryExecPipelineSql(dbInst *gorm.DB, sqlList []string, dbConf config.DatabaseConfig) (*gorm.DB, error)

func TryExecSql

func TryExecSql(dbInst *gorm.DB, sql string, dbConf config.DatabaseConfig) (*gorm.DB, error)

Types

type TableEventOrphan added in v0.0.2

type TableEventOrphan struct {
	SnapshotID            string `json:"snapshot_id"`
	EventTypeOrphan       int    `json:"event_type_orphan"`
	OrphanParentBlockHash string `json:"orphan_parent_block_hash"`
	OrphanBlockHash       string `json:"orphan_block_hash"`
	ConnectMainChain      int    `json:"connect_main_chain"`
	EventOrphanTimestamp  string `json:"event_orphan_timestamp"`
}

type TableRevision

type TableRevision struct {
	SnapshotID     string `json:"snapshot_id"`
	RevisionType   int    `json:"revision_type"`
	InitTimestamp  string `json:"init_timestamp"`
	FinalTimestamp string `json:"final_timestamp"`
	InitData       string `json:"init_data"`  // json str
	FinalData      string `json:"final_data"` // json str
}

type TableSnapshotData

type TableSnapshotData struct {
	SnapshotID        string `json:"snapshot_id"`
	TargetChainID     string `json:"target_chain_id"`
	TargetChainHeight int32  `json:"target_chain_height"`
	BlockHash         string `json:"block_hash"`
	IsOrphan          int    `json:"is_orphan"`
	InitTimestamp     string `json:"init_timestamp"`
	FinalTimestamp    string `json:"final_timestamp"`
}

type TableSnapshotSync

type TableSnapshotSync struct {
	SnapshotID        string `json:"snapshot_id"`
	TargetChainID     string `json:"target_chain_id"`
	TargetChainHeight int32  `json:"target_chain_height"`
	SyncTimestamp     string `json:"sync_timestamp"`
}

type TableState

type TableState struct {
	SnapshotID      string `json:"snapshot_id"`
	SnapshotType    int    `json:"snapshot_type"`
	BestBlockHash   string `json:"best_block_hash"`
	Height          int32  `json:"height"`
	Bits            uint32 `json:"bits"`
	BlockSize       uint64 `json:"block_size"`
	BlockWeight     uint64 `json:"block_weight"`
	NumTxns         uint64 `json:"num_txns"`
	TotalTxns       uint64 `json:"total_txns"`
	MedianTimestamp string `json:"median_timestamp"`
}

Jump to

Keyboard shortcuts

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