md

package module
v0.0.0-...-319c208 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: GPL-3.0 Imports: 30 Imported by: 0

README

go-modules

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Topic_ERC20Created   = crypto.Keccak256Hash([]byte("ERC20Created(address,address)"))
	Topic_ERC721Created  = crypto.Keccak256Hash([]byte("ERC721Created(address,address)"))
	Topic_ERC1155Created = crypto.Keccak256Hash([]byte("ERC1155Created(address,address)"))
	Topic_LogDeploy      = crypto.Keccak256Hash([]byte("LogDeploy(address,bytes,address)"))
)
View Source
var (
	LogPrefixFn  = LogPrefixDay
	LogKeepFiles = 3
)
View Source
var ErrNoRows error = sql.ErrNoRows
View Source
var ErrPtrNil = errors.New("nil pointer passed to StructScan destination")
View Source
var (
	SigHup = syscall.SIGHUP
)

Functions

func ABIDecodeString

func ABIDecodeString(data []byte) (bps []*big.Int, address []string, err error)

func ChecksumAddress

func ChecksumAddress(address string) string

func ClosePgSqlTxConn

func ClosePgSqlTxConn(conn *sqlx.DB, tx *sql.Tx, inoutErr *error)

func CloseSqlTxConn

func CloseSqlTxConn(conn *sqlx.DB, tx *sql.Tx, inoutErr *error)

func ExpandSqlResult

func ExpandSqlResult(res sql.Result) (affected uint64, lastid uint64, err error)

func GetSvrmark

func GetSvrmark(svrname string, serverid ...string) string

func If

func If(condition bool, trueVal, falseVal interface{}) interface{}

func InArray

func InArray(needle interface{}, hystack interface{}) bool

chk element in array

func InitArweave

func InitArweave(key_file string, ar_node string) (*goar.Wallet, error)

func InitLog

func InitLog(logdir string, svrname string, warnstr string, fn func(s string), intervals ...int64)

func IsSqlErr

func IsSqlErr(err error) bool

func KeepLogFiles

func KeepLogFiles(fdir string, pattern string, nfile int)

func LogBool

func LogBool(cond bool, args ...interface{})

func LogD

func LogD(format string, v ...interface{})

func LogError

func LogError(err error, args ...interface{})

func LogPrefixDay

func LogPrefixDay(t time.Time) (prefix string, patternstr string)

func LogPrefixHour

func LogPrefixHour(t time.Time) (prefix string, patternstr string)

func LogUid

func LogUid(uid uint64, format string, v ...interface{})

func LogW

func LogW(format string, v ...interface{})

func LogWrite

func LogWrite(w io.Writer, level string, format string, v ...interface{})

func LowerCaseWithUnderscores

func LowerCaseWithUnderscores(name string) string

func NewError

func NewError(format string, v ...interface{}) error

func NewPgSqlTxConn

func NewPgSqlTxConn() (conn *sqlx.DB, tx *sql.Tx, err error)

func NewSqlTxConn

func NewSqlTxConn() (conn *sqlx.DB, tx *sql.Tx, err error)

func PgGet

func PgGet(sqlstr string, dest interface{}) (err error)

func PgSelect

func PgSelect(sqlstr string, dest interface{}) (err error)

func SqlGet

func SqlGet(sqlstr string, dest interface{}) (err error)

func SqlTxExec

func SqlTxExec(sqltx *sql.Tx, sqlstr string) (err error)

func SqlTxProc

func SqlTxProc(sqltx *sql.Tx, inoutErr *error)

func ToSlice

func ToSlice(arr interface{}) ([]interface{}, bool)

convert to array

func ValidateStruct

func ValidateStruct(val interface{}) (err error)

Types

type Batch

type Batch struct {
	BPS    []*big.Int `abi:"recipientBPS_"`
	Values []string   `abi:"recipients_"`
}

type CmdArgs

type CmdArgs = struct {
	CfgFiles []string
	LogPath  string
	Name     string
	Debug    int64
	Daemon   bool
	Version  bool
	Help     bool

	Parsed bool
}
var GCmdArgs CmdArgs

func ParseCmdArgs

func ParseCmdArgs(ver string) (ca *CmdArgs)

type Config

type Config struct {
	// contains filtered or unexported fields
}
var GConfig *Config

func InitConfig

func InitConfig(cfg_files interface{}, fn func(c *Config)) (*Config, error)

func (*Config) Bool

func (c *Config) Bool(sesskey string, defs ...bool) bool

func (*Config) BoolArray

func (c *Config) BoolArray(sesskey string, defs ...[]bool) []bool

func (*Config) Int64

func (c *Config) Int64(sesskey string, defs ...int64) int64

func (*Config) Int64Array

func (c *Config) Int64Array(sesskey string, defs ...[]int64) []int64

func (*Config) SaveToml

func (c *Config) SaveToml(fname string) error

func (*Config) SessDecode

func (c *Config) SessDecode(sess string, pdata interface{}) error

func (*Config) SessDecodeMap

func (c *Config) SessDecodeMap(cfgmap map[string]interface{}) error

func (*Config) SetSess

func (c *Config) SetSess(sess string, v interface{})

func (*Config) SetValue

func (c *Config) SetValue(sesskey string, v interface{})

func (*Config) String

func (c *Config) String(sesskey string, defs ...string) string

func (*Config) StringArray

func (c *Config) StringArray(sesskey string, defs ...[]string) []string

type MysqlCfg

type MysqlCfg struct {
	Host string `toml:"host,omitzero"`
	Port int64  `toml:"port,omitzero"`
	User string `toml:"user,omitzero"`
	Pass string `toml:"pass,omitzero"`
}

type MysqlPool

type MysqlPool struct {
	// contains filtered or unexported fields
}
var GMysqlPool *MysqlPool

func InitMysqlPool

func InitMysqlPool(Host, UserName, Password, Database string, Port int64) (p *MysqlPool, e error)

func InitMysqlPool2

func InitMysqlPool2(cfg *MysqlCfg, Database string) (p *MysqlPool, e error)

func (*MysqlPool) BatchExec

func (p *MysqlPool) BatchExec(sqls []string) (err error)

func (*MysqlPool) BeginTx

func (p *MysqlPool) BeginTx() (tx *sqlx.Tx, err error)

func (*MysqlPool) EndTx

func (p *MysqlPool) EndTx(tx *sqlx.Tx, perr *error) error

func (*MysqlPool) GetConn

func (p *MysqlPool) GetConn() *sqlx.DB

func (*MysqlPool) Query

func (p *MysqlPool) Query(sqlstr string) ([]map[string]sql.RawBytes, error)

func (*MysqlPool) SingleExec

func (p *MysqlPool) SingleExec(sqlstr string) (affected uint64, lastid uint64, err error)

func (*MysqlPool) SingleGetInt64

func (p *MysqlPool) SingleGetInt64(sqlstr string) (v int64, err error)

func (*MysqlPool) SingleGetRow

func (p *MysqlPool) SingleGetRow(p_struct_row interface{}, sqlstr string) error

func (*MysqlPool) SingleGetVal

func (p *MysqlPool) SingleGetVal(p_val interface{}, sqlstr string) error

func (*MysqlPool) SingleSelect

func (p *MysqlPool) SingleSelect(p_struct_rows interface{}, sqlstr string) error

func (*MysqlPool) TxExec

func (p *MysqlPool) TxExec(tx *sqlx.Tx, sqlstr string, perr *error) (affected uint64, lastid uint64, err error)

func (*MysqlPool) UnGetConn

func (p *MysqlPool) UnGetConn(db interface{})

type PostgresCfg

type PostgresCfg struct {
	Host      string `toml:"host,omitzero"`
	Port      int64  `toml:"port,omitzero"`
	User      string `toml:"user,omitzero"`
	Pass      string `toml:"pass,omitzero"`
	EnableSsl bool   `toml:"ssl,omitzero"`
}

type PostgresConnConfig

type PostgresConnConfig struct {
	DBName         string `json:"dbname"`
	User           string `json:"user"`
	Password       string `json:"password"`
	Host           string `json:"host"`
	Port           int64  `json:"port"`
	ConnectTimeout int64  `json:"connect_timeout"`
	EnableSsl      bool   `json:"ssl"`
}

func (*PostgresConnConfig) FormatDSN

func (c *PostgresConnConfig) FormatDSN() string

type PostgresPool

type PostgresPool struct {
	// contains filtered or unexported fields
}
var (
	GPostgresPool *PostgresPool
)

func InitPostgresPool

func InitPostgresPool(Host string, User string, Pass string, Port int64, Database string) (pool *PostgresPool, err error)

func InitPostgresPoolViaUrl

func InitPostgresPoolViaUrl(url string) (pool *PostgresPool, err error)

func (*PostgresPool) GetConn

func (p *PostgresPool) GetConn() *sqlx.DB

func (*PostgresPool) UnGetConn

func (p *PostgresPool) UnGetConn(db interface{})

type SignalHandler

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

func NewSignalHandler

func NewSignalHandler(sig syscall.Signal) *SignalHandler

func (*SignalHandler) GetChan

func (h *SignalHandler) GetChan() <-chan os.Signal

type Sqler

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

Sqler is data mapper struct

func NewSqler

func NewSqler(args ...interface{}) *Sqler

func (*Sqler) Avg

func (dba *Sqler) Avg(avg string) string

Avg : select avg field

func (*Sqler) BuildExecut

func (dba *Sqler) BuildExecut() (string, error)

BuildExecut : build execute query string

func (*Sqler) BuildQuery

func (dba *Sqler) BuildQuery() (string, error)

BuildQuery : build query string

func (*Sqler) Count

func (dba *Sqler) Count(args ...interface{}) string

Count : select count rows

func (*Sqler) Delete

func (dba *Sqler) Delete() string

Delete : delete data

func (*Sqler) Distinct

func (dba *Sqler) Distinct() *Sqler

Distinct : select distinct

func (*Sqler) Group

func (dba *Sqler) Group(group string) *Sqler

Group : select group by

func (*Sqler) Having

func (dba *Sqler) Having(having string) *Sqler

Having : select having

func (*Sqler) Ignore

func (dba *Sqler) Ignore() *Sqler

func (*Sqler) Insert

func (dba *Sqler) Insert(data interface{}) string

Insert : insert data

func (*Sqler) InsertBatch

func (dba *Sqler) InsertBatch(data interface{}) string

func (*Sqler) InsertDuplicate

func (dba *Sqler) InsertDuplicate(data interface{}, key_fields []string, args ...interface{}) string

func (*Sqler) Join

func (dba *Sqler) Join(args ...interface{}) *Sqler

Join : select join query

func (*Sqler) LeftJoin

func (dba *Sqler) LeftJoin(args ...interface{}) *Sqler

LeftJoin : like join , the relation is left

func (*Sqler) Limit

func (dba *Sqler) Limit(limit int) *Sqler

Limit : select limit

func (*Sqler) Max

func (dba *Sqler) Max(max string) string

Max : select max field

func (*Sqler) Min

func (dba *Sqler) Min(min string) string

Min : select min field

func (*Sqler) Offset

func (dba *Sqler) Offset(offset int) *Sqler

Offset : select offset

func (*Sqler) OrWhere

func (dba *Sqler) OrWhere(args ...interface{}) *Sqler

OrWhere : like where , but the relation is or,

func (*Sqler) Order

func (dba *Sqler) Order(order string) *Sqler

Order : select order by

func (*Sqler) Page

func (dba *Sqler) Page(page int) *Sqler

Page : select page

func (*Sqler) PgBuildQuery

func (dba *Sqler) PgBuildQuery() (string, error)

func (*Sqler) PgSelect

func (dba *Sqler) PgSelect(args ...interface{}) string

func (*Sqler) PgTable

func (dba *Sqler) PgTable(table string) *Sqler

Table : select table

func (*Sqler) Reset

func (dba *Sqler) Reset()

func (*Sqler) RightJoin

func (dba *Sqler) RightJoin(args ...interface{}) *Sqler

RightJoin : like join , the relation is right

func (*Sqler) Select

func (dba *Sqler) Select(args ...interface{}) string

func (*Sqler) Sum

func (dba *Sqler) Sum(sum string) string

Sum : select sum field

func (*Sqler) Table

func (dba *Sqler) Table(table string) *Sqler

Table : select table

func (*Sqler) Update

func (dba *Sqler) Update(data interface{}, args ...interface{}) string

Update : update data: string, map[string]interface{}, struct

func (*Sqler) UpdateBatch

func (dba *Sqler) UpdateBatch(data []map[string]interface{}, keyarr interface{}, args ...interface{}) string

func (*Sqler) Where

func (dba *Sqler) Where(args ...interface{}) *Sqler

Where : query or execute where condition, the relation is and

type SysConfig

type SysConfig struct {
	// contains filtered or unexported fields
}
var GSysConfig *SysConfig

func InitSysConfig

func InitSysConfig(sql_pool *MysqlPool, table_name, key_field, val_field string) (sc *SysConfig, err error)

func (*SysConfig) Bool

func (sc *SysConfig) Bool(sesskey string, defs ...bool) (defval bool)

func (*SysConfig) BoolArray

func (sc *SysConfig) BoolArray(sesskey string, defs ...[]bool) (defval []bool)

func (*SysConfig) Int64

func (sc *SysConfig) Int64(sesskey string, defs ...int64) (defval int64)

func (*SysConfig) Int64Array

func (sc *SysConfig) Int64Array(sesskey string, defs ...[]int64) (defval []int64)

func (*SysConfig) Read

func (sc *SysConfig) Read(key string, pval interface{}) (err error)

func (*SysConfig) Store

func (sc *SysConfig) Store(key string, val interface{}) (err error)

func (*SysConfig) String

func (sc *SysConfig) String(sesskey string, defs ...string) (defval string)

func (*SysConfig) StringArray

func (sc *SysConfig) StringArray(sesskey string, defs ...[]string) (defval []string)

type TagOptions

type TagOptions struct {
	Skip      bool
	Name      string
	Omitempty bool
	Omitzero  bool
}

func GetTagOptions

func GetTagOptions(tag reflect.StructTag, tagname string) TagOptions

Jump to

Keyboard shortcuts

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