mysql

package
v0.0.0-...-4cb4d4a Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2022 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Endpoint string `json:"endpoint"`
	UserName string `json:"user"`
	Password string `json:"password"`
	Database string `json:"database"`
	Port     int    `json:"port"`
	PoolSize int    `json:"poolSize"`

	Coin         string `json:"coin"`
	Threshold    int64  `json:"threshold"`
	LogTableName string `json:"logTableName"`
}

type Database

type Database struct {
	Conn  *sql.DB
	Redis *redis.RedisClient

	Config           *Config
	DiffByShareValue int64
}

func New

func New(cfg *Config, proxyDiff int64, redis *redis.RedisClient) (*Database, error)

func (*Database) ChangeAccountAccess

func (d *Database) ChangeAccountAccess(user string, access string) bool

func (*Database) ChangeAccountPassword

func (d *Database) ChangeAccountPassword(user string, pass []byte) bool

func (*Database) CheckTimeMinerCharts

func (d *Database) CheckTimeMinerCharts(miner *MinerChartSelect, ts int64, minerChartIntvSec int64) bool

func (*Database) CollectLuckStats

func (d *Database) CollectLuckStats(windowMax int64) ([]*types.BlockData, error)

func (*Database) CollectStats

func (d *Database) CollectStats(maxBlocks int64) ([]*types.BlockData, []*types.BlockData, []*types.BlockData, int, []map[string]interface{}, int64, error)

func (*Database) CreateAccount

func (d *Database) CreateAccount(user string, pass []byte, access string) bool

func (*Database) DelIdInbound

func (d *Database) DelIdInbound(id string) bool

func (*Database) DelIpInbound

func (d *Database) DelIpInbound(ip string) bool

func (*Database) DelSubIdIndex

func (d *Database) DelSubIdIndex(devId, subId string) bool

func (*Database) DeleteAccount

func (d *Database) DeleteAccount(user string) bool

func (*Database) DeleteBlockBalance

func (d *Database) DeleteBlockBalance(min, max int64) int64

func (*Database) GetAccountList

func (d *Database) GetAccountList() ([]*types.UserInfo, error)

func (*Database) GetAccountPassword

func (d *Database) GetAccountPassword(id string) (string, string, error)

func (*Database) GetAlarmInfo

func (d *Database) GetAlarmInfo() (map[string]*types.InboundIdList, error)

func (*Database) GetAllMinerAccount

func (d *Database) GetAllMinerAccount(duration time.Duration, minerChartIntvSec int64) ([]*MinerChartSelect, error)

func (*Database) GetAllPayments

func (d *Database) GetAllPayments(maxPayments int64) ([]map[string]interface{}, int64, error)

func (*Database) GetBanWhitelist

func (d *Database) GetBanWhitelist() (mapset.Set, error)

func (*Database) GetBlockBalanceMinMax

func (d *Database) GetBlockBalanceMinMax() (int64, int64)

func (*Database) GetCandidates

func (d *Database) GetCandidates(maxHeight int64) ([]*types.BlockData, error)

func (*Database) GetChartRewardList

func (d *Database) GetChartRewardList(login string, maxList int) ([]*types.RewardData, error)

func (*Database) GetIdInboundList

func (d *Database) GetIdInboundList() ([]*types.InboundIdList, error)

func (*Database) GetImmatureBlocks

func (d *Database) GetImmatureBlocks(maxHeight int64) ([]*types.BlockData, error)

func (*Database) GetIpInboundList

func (d *Database) GetIpInboundList() ([]*types.InboundIpList, error)

func (*Database) GetLikeMinerSubList

func (d *Database) GetLikeMinerSubList(addr string) ([]*types.DevSubList, error)

func (*Database) GetMinerCharts

func (d *Database) GetMinerCharts(hashNum int64, chartIntv int64, login string, ts int64) (stats []*types.MinerCharts, err error)

func (*Database) GetMinerStats

func (d *Database) GetMinerStats(login string, maxPayments int64) (map[string]interface{}, error)

func (*Database) GetMinerSubInfo

func (d *Database) GetMinerSubInfo(devId string) ([]*types.DevSubList, error)

func (*Database) GetMinerSubList

func (d *Database) GetMinerSubList() ([]*types.DevSubList, error)

func (*Database) GetPayees

func (d *Database) GetPayees(max string) ([]*Payees, error)

func (*Database) GetPoolBalanceByOnce

func (d *Database) GetPoolBalanceByOnce(maxHeight, minHeight int64, coin string) (*big.Int, int64, error)

func (*Database) InsertSqlLog

func (d *Database) InsertSqlLog(sql *string)

func (*Database) IsIdInboundId

func (d *Database) IsIdInboundId(devID string) bool

func (*Database) IsMinerExists

func (d *Database) IsMinerExists(login string) (bool, int64, error)

func (*Database) SaveIdInbound

func (d *Database) SaveIdInbound(id, rule, alarm, desc string) bool

func (*Database) SaveIpInbound

func (d *Database) SaveIpInbound(ip, rule string) bool

func (*Database) SaveSubIdIndex

func (d *Database) SaveSubIdIndex(devId, subId string, amount int64) bool

func (*Database) UpdateBalance

func (d *Database) UpdateBalance(login string, amount int64, gasFee int64, coin string) (int, error)

UpdateBalance Confirm the reward coin with the miner's wallet address.

func (*Database) UpdateIdInboundAlarm

func (d *Database) UpdateIdInboundAlarm(id, alarm string) bool

func (*Database) UpdateIdInboundDesc

func (d *Database) UpdateIdInboundDesc(id, desc string) bool

func (*Database) UpdatePayoutLimit

func (d *Database) UpdatePayoutLimit(login string, dgcValue string) bool

func (*Database) WriteBlock

func (d *Database) WriteBlock(login, id string, params []string, diff, roundDiff int64, height uint64, window time.Duration, hostname string)

func (*Database) WriteCandidates

func (d *Database) WriteCandidates(height uint64, params []string, nowTime string, ts int64, roundDiff int64, totalShares int64)

func (*Database) WriteImmatureBlock

func (d *Database) WriteImmatureBlock(block *types.BlockData, roundRewards map[string]int64, percents map[string]*big.Rat) error

func (*Database) WriteImmatureError

func (d *Database) WriteImmatureError(block *types.BlockData, blockState int, errNum int) error

func (*Database) WriteMaturedBlock

func (d *Database) WriteMaturedBlock(block *types.BlockData, roundRewards map[string]int64, percents map[string]*big.Rat) error

WriteMaturedBlock If the reward miner is more than 20,000, you need to increase the query capacity or modify it!!

func (*Database) WriteMinerCharts

func (d *Database) WriteMinerCharts(time1 int64, time2, k string, hash, largeHash, workerOnline int64, share int64, report int64) error

func (*Database) WriteOrphan

func (d *Database) WriteOrphan(block *types.BlockData) error

func (*Database) WritePayment

func (d *Database) WritePayment(login, txHash string, amount int64, gasFee int64, coin string, from string) error

func (*Database) WritePendingOrphans

func (d *Database) WritePendingOrphans(blocks []*types.BlockData) error

func (*Database) WriteShare

func (d *Database) WriteShare(login, id string, params []string, diff int64, height uint64, window time.Duration, hostname string) error

type ImmaturedState

type ImmaturedState string

type LogEntrie

type LogEntrie struct {
	Entries string
	Addr    string
}

type MinerChartSelect

type MinerChartSelect struct {
	Coin           string
	Addr           string
	Share          int
	ShareCheckTime int64
}

type Payees

type Payees struct {
	Coin         string
	Addr         string
	Balance      int64
	Payout_limit int64
}

Jump to

Keyboard shortcuts

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