sql

package
v0.2.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TableAddressUpdates = "address_updates"
	TableTxs            = "txs"
	TableInputs         = "inputs"
	TableOutputs        = "outputs"
	TableBlocks         = "blocks"
	TableBlockTxs       = "block_txs"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	Prefix string
	Db     *sql.DB
}

func NewDatabase

func NewDatabase(db *sql.DB, prefix string) (*Database, error)

func (*Database) GetAddressBalance

func (d *Database) GetAddressBalance(address wallet.Addr) (int64, error)

func (*Database) GetAddressLastUpdate

func (d *Database) GetAddressLastUpdate(address wallet.Addr) (time.Time, error)

func (*Database) GetInsert

func (d *Database) GetInsert(table string, values map[string]interface{}) *Query

func (*Database) GetTableName

func (d *Database) GetTableName(table string) string

func (*Database) GetUtxos

func (d *Database) GetUtxos(address wallet.Addr) ([]graph.Output, error)

func (*Database) SaveTxs

func (d *Database) SaveTxs(txs []graph.Tx) error

func (*Database) SetAddressLastUpdate

func (d *Database) SetAddressLastUpdate(address wallet.Addr, t time.Time) error

type Query

type Query struct {
	Name      string
	Query     string
	Variables []interface{}
}

type Table

type Table struct {
	Name    string
	Columns map[string]string
	Indexes []string
}

func (Table) GetDefinition

func (t Table) GetDefinition(prefix string) string

func (Table) GetInsert

func (t Table) GetInsert(prefix string, values map[string]interface{}) Query

func (Table) GetName

func (t Table) GetName(prefix string) string

Jump to

Keyboard shortcuts

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