sqlite

package
v0.0.0-...-11adfba Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeginTx

func BeginTx(client *Client) (tx *sql.Tx, err error)

func BlockCreateExec

func BlockCreateExec(stmt *sql.Stmt, item Block) (result sql.Result, err error)

func BlockCreatePrepare

func BlockCreatePrepare(tx *sql.Tx) (stmt *sql.Stmt, err error)

func BlockDeleteExec

func BlockDeleteExec(stmt *sql.Stmt, item Block) (result sql.Result, err error)

BlockDeleteExec only need item.Height now

func BlockDeletePrepare

func BlockDeletePrepare(tx *sql.Tx) (stmt *sql.Stmt, err error)

func ClearTables

func ClearTables(db *sql.DB) (err error)

func CommitTx

func CommitTx(tx *sql.Tx) (err error)

func ContractCreateExec

func ContractCreateExec(stmt *sql.Stmt, item Contract) (result sql.Result, err error)

func ContractCreatePrepare

func ContractCreatePrepare(tx *sql.Tx) (stmt *sql.Stmt, err error)

func ContractDeleteExec

func ContractDeleteExec(stmt *sql.Stmt, item Contract) (result sql.Result, err error)

func ContractDeletePrepare

func ContractDeletePrepare(tx *sql.Tx) (stmt *sql.Stmt, err error)

func ExecPrepare

func ExecPrepare(stmt *sql.Stmt, args ...interface{}) (result sql.Result, err error)

func New

func New(client *Client) (err error)

func PrepareTx

func PrepareTx(tx *sql.Tx, sql string) (stmt *sql.Stmt, err error)

func RollbackTx

func RollbackTx(tx *sql.Tx) (err error)

func TxCreateExec

func TxCreateExec(stmt *sql.Stmt, pre PreUtxo) (result sql.Result, err error)

func TxCreatePrepare

func TxCreatePrepare(tx *sql.Tx) (stmt *sql.Stmt, err error)

func TxDeleteExec

func TxDeleteExec(stmt *sql.Stmt, item PreUtxo) (result sql.Result, err error)

TxDeleteExec only need item.TxID now

func TxDeletePrepare

func TxDeletePrepare(tx *sql.Tx) (stmt *sql.Stmt, err error)

func UtxoCreateExec

func UtxoCreateExec(stmt *sql.Stmt, item Utxo) (result sql.Result, err error)

func UtxoCreatePrepare

func UtxoCreatePrepare(tx *sql.Tx) (stmt *sql.Stmt, err error)

func UtxoDeleteExec

func UtxoDeleteExec(stmt *sql.Stmt, item Utxo) (result sql.Result, err error)

UtxoDeleteExec only need item.BlockHeight now

func UtxoDeletePrepare

func UtxoDeletePrepare(tx *sql.Tx) (stmt *sql.Stmt, err error)

func UtxoUpdateExec

func UtxoUpdateExec(stmt *sql.Stmt, item Utxo) (result sql.Result, err error)

UtxoUpdateExec only need item.IsSpent, ID, Vout now

func UtxoUpdatePrepare

func UtxoUpdatePrepare(tx *sql.Tx) (stmt *sql.Stmt, err error)

Types

type Block

type Block struct {
	Height uint64
	Hash   string
}

type Client

type Client struct {
	DbPath   string
	Instance *sql.DB
}

func (*Client) Close

func (client *Client) Close() (err error)

func (*Client) Error

func (client *Client) Error() error

func (*Client) GetAddressUtxo

func (client *Client) GetAddressUtxo(address string, maxHeight int) (*[]Utxo, error)

func (*Client) GetAllUtxo

func (client *Client) GetAllUtxo(maxHeight int) (*[]Utxo, error)

func (*Client) GetBlockHash

func (client *Client) GetBlockHash(height uint64) (string, error)

func (*Client) GetBlockTxList

func (client *Client) GetBlockTxList(height uint64) (*[]string, error)

func (*Client) GetContractList

func (client *Client) GetContractList(protocol string) (*[]Contract, error)

GetContractList get contract list by protocol, when protocol is "undefined" mean all contract do not have general interface

func (*Client) GetFirstBlockInfo

func (client *Client) GetFirstBlockInfo() ([]Block, error)

func (*Client) GetPreUtxo

func (client *Client) GetPreUtxo(txid string) (*[]PreUtxo, error)

func (*Client) GetUtxoByHeight

func (client *Client) GetUtxoByHeight(height uint64) (*[]Utxo, error)

type Contract

type Contract struct {
	TxID             string
	ContractAddress  string
	ContractAction   our_chain_rpc.ContractAction
	ContractProtocol string
	ContractVersion  string
}

type PreUtxo

type PreUtxo struct {
	TxID    string
	PreTxID string
	PreVout int
}

type Utxo

type Utxo struct {
	ID          string // txid
	Address     string
	Vout        int
	Amount      float64
	IsSpent     bool
	BlockHeight uint64
}

Jump to

Keyboard shortcuts

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