database

package
v0.0.0-...-d48546e Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ListSeparator = ","
)

Variables

This section is empty.

Functions

func InsertCoin

func InsertCoin(dbClient *Database, ip Coin) (err error)

func InsertCoinDynamics

func InsertCoinDynamics(dbClient *Database, dynamics CoinDynamics) (err error)

func InsertIP

func InsertIP(dbClient *Database, ip CoinIp) (err error)

func InsertTPoSContract

func InsertTPoSContract(dbClient *Database, contract TPoSContract) (err error)

func SetActive

func SetActive(dbClient *Database, coin string, ips []string) (err error)

func SetAllInactive

func SetAllInactive(dbClient *Database, coin string) (err error)

func SetAllTPoSContractsInactive

func SetAllTPoSContractsInactive(dbClient *Database) (err error)

func SetMysqlConnect

func SetMysqlConnect(str string)

func SetTPoSContractsActive

func SetTPoSContractsActive(dbClient *Database, hashTx []string) (err error)

func TruncateCoinDynamics

func TruncateCoinDynamics(dbClient *Database) (err error)

func UpdateTPosContract

func UpdateTPosContract(dbClient *Database, contract TPoSContract) (err error)

Types

type Coin

type Coin struct {
	Name            string    `db:"name"`
	Symbol          string    `db:"symbol"`
	CMCId           int       `db:"cmc_id"`
	Labels          string    `db:"labels"`
	Consensus       string    `db:"consensus"`
	ImagePath       string    `db:"image_path"`
	Website         string    `db:"website"`
	Explorer        string    `db:"explorer"`
	Github          string    `db:"github"`
	Twitter         string    `db:"twitter"`
	Discord         string    `db:"discord"`
	Reddit          string    `db:"reddit"`
	Telegram        string    `db:"telegram"`
	Articles        string    `db:"articles"`
	State           string    `db:"state"`
	DateAdded       time.Time `db:"date_added"`
	Description     string    `db:"description"`
	DescriptionHTML template.HTML
}

func GetAllCoins

func GetAllCoins(dbClient *Database) (ips []Coin, err error)

func GetCoin

func GetCoin(dbClient *Database, symbol string) (ips Coin, err error)

func (*Coin) SetConsensusString

func (c *Coin) SetConsensusString(consensus []string)

func (*Coin) SetLabelString

func (c *Coin) SetLabelString(labels []string)

func (*Coin) StringToConsensus

func (c *Coin) StringToConsensus() []string

func (*Coin) StringToLabels

func (c *Coin) StringToLabels() []string

type CoinDynamics

type CoinDynamics struct {
	Symbol            string    `db:"symbol"`
	CMCId             int       `db:"cmc_id"`
	CMCRank           int       `db:"cmc_rank"`
	PriceUSD          string    `db:"price_usd"`
	Price1H           string    `db:"price_1h"`
	Price24H          string    `db:"price_24h"`
	Price7D           string    `db:"price_7d"`
	SupplyCirculating string    `db:"supply_circulating"`
	SupplyTotal       string    `db:"supply_total"`
	SupplyMax         string    `db:"supply_max"`
	UpdatedAt         time.Time `db:"updated_at"`
}

func GetAllCoinDynamics

func GetAllCoinDynamics(dbClient *Database) (ips []CoinDynamics, err error)

func GetCoinDynamics

func GetCoinDynamics(dbClient *Database, symbol string) (ips CoinDynamics, err error)

type CoinIp

type CoinIp struct {
	Ip            string    `db:"ip"`
	IpType        string    `db:"ip_type"`
	CoinName      string    `db:"coin_name"`
	CountryCode   string    `db:"country_code"`
	CountryName   string    `db:"country_name"`
	ContinentName string    `db:"continent_name"`
	City          string    `db:"city"`
	Zip           string    `db:"zip"`
	Hostname      string    `db:"hostname"`
	Provider      string    `db:"provider"`
	Latitude      float64   `db:"latitude"`
	Longitude     float64   `db:"longitude"`
	LastChecked   time.Time `db:"last_checked_at"`
	Active        bool      `db:"active"`
}

func Get

func Get(dbClient *Database, coin string) (ips []CoinIp, err error)

func GetActiveMNIPsForCoin

func GetActiveMNIPsForCoin(dbClient *Database, coin string) (ips []CoinIp, err error)

type Database

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

func GetDB

func GetDB() (*Database, error)

func (*Database) Exec

func (db *Database) Exec(query string, args ...interface{}) (result Result, err error)

func (*Database) Get

func (db *Database) Get(dest interface{}, query string, args ...interface{}) error

func (*Database) Insert

func (db *Database) Insert(table string, object interface{}) (r Result, err error)

func (*Database) MustExec

func (db *Database) MustExec(query string, args ...interface{}) Result

func (*Database) NamedExec

func (db *Database) NamedExec(query string, arg interface{}) (Result, error)

func (*Database) Select

func (db *Database) Select(dest interface{}, query string, args ...interface{}) error

type Result

type Result sql.Result

type TPoSContract

type TPoSContract struct {
	Id              int       `db:"id"`
	MerchantAddress string    `db:"merchant_address"`
	OwnerAddress    string    `db:"owner_address"`
	ActiveSince     time.Time `db:"active_since"`
	HashTx          string    `db:"hash_tx"`
	Commission      float64   `db:"commission"`
	Active          bool      `db:"active"`
	IP              string    `db:"ip"`
}

func GetActiveTPoSContracts

func GetActiveTPoSContracts(dbClient *Database) (contracts []TPoSContract, err error)

func GetTPoSContracts

func GetTPoSContracts(dbClient *Database) (contracts []TPoSContract, err error)

type Tx

type Tx sqlx.Tx

Jump to

Keyboard shortcuts

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