db

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIQuery

func APIQuery(query string, args ...interface{}) (interface{}, error)

APIQuery is the entry point from the API to chainquery. The results are turned into json.

func CloseDB

func CloseDB(db *QueryLogger)

CloseDB is a wrapper function to allow error handle when it is usually deferred.

func GetTableStatus

func GetTableStatus() (*g.ChainqueryStatus, error)

GetTableStatus provides size information for the tables in the chainquery database

Types

type AddressSummary

type AddressSummary struct {
	ID            uint64  `boil:"id"`
	Address       string  `boil:"address"`
	TotalReceived float64 `boil:"total_received"`
	TotalSent     float64 `boil:"total_sent"`
	Balance       float64 `boil:"balance"`
}

AddressSummary summarizes information for an address from chainquery database

func GetAddressSummary

func GetAddressSummary(address string) (*AddressSummary, error)

GetAddressSummary returns summary information of an address in the chainquery database.

type QueryLogger

type QueryLogger struct {
	DB      *sqlx.DB
	Logger  *log.Logger
	Enabled bool
}

QueryLogger implements the Executor interface

func Init

func Init(dsn string, debug bool) (*QueryLogger, error)

Init initializes a database connection based on the dsn provided. It also sets it as the global db connection.

func InitAPIQuery

func InitAPIQuery(dsn string, debug bool) (*QueryLogger, error)

InitAPIQuery initializes the api chainquery db connection

func (*QueryLogger) Begin

func (d *QueryLogger) Begin() (boil.Transactor, error)

Begin implements the Executor Begin function

func (*QueryLogger) Close

func (d *QueryLogger) Close() error

Close implements the Executor Close function

func (*QueryLogger) Exec

func (d *QueryLogger) Exec(query string, args ...interface{}) (sql.Result, error)

Exec implements the Executor Exec function

func (*QueryLogger) Query

func (d *QueryLogger) Query(query string, args ...interface{}) (*sql.Rows, error)

Query implements the Executor Query function

func (*QueryLogger) QueryRow

func (d *QueryLogger) QueryRow(query string, args ...interface{}) *sql.Row

QueryRow implements the Executor QueryRow function

Jump to

Keyboard shortcuts

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