common

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2019 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const NumOfBPNode = 42

Variables

This section is empty.

Functions

func CalcStandByNodes added in v1.0.1

func CalcStandByNodes(voteResult []*api.VoteInfo) []*api.VoteInfo

func Get added in v1.0.1

func Get(url string, result interface{}) error

func GetAddressFromControlProgram

func GetAddressFromControlProgram(prog []byte) string

func GetControlProgramFromAddress added in v1.0.1

func GetControlProgramFromAddress(address string) ([]byte, error)

func NewMySQLDB

func NewMySQLDB(cfg MySQLConfig) (*gorm.DB, error)

func Post added in v1.0.1

func Post(url string, payload []byte, result interface{}) error

Types

type MySQLConfig

type MySQLConfig struct {
	Connection MySQLConnection `json:"connection"`
	LogMode    bool            `json:"log_mode"`
}

type MySQLConnection

type MySQLConnection struct {
	Host     string `json:"host"`
	Port     uint   `json:"port"`
	Username string `json:"username"`
	Password string `json:"password"`
	DbName   string `json:"database"`
}

type Timestamp added in v1.0.2

type Timestamp time.Time

func (*Timestamp) MarshalJSON added in v1.0.2

func (t *Timestamp) MarshalJSON() ([]byte, error)

func (*Timestamp) Unix added in v1.0.2

func (t *Timestamp) Unix() int64

func (*Timestamp) UnmarshalJSON added in v1.0.2

func (t *Timestamp) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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