common

package
v0.0.0-...-105474d Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EtcdDelete

func EtcdDelete(keyString string) (bool, error)

func EtcdDeletePrefix

func EtcdDeletePrefix(prefixString string) (bool, error)

func EtcdGet

func EtcdGet(keyString string) (string, error)

func EtcdGetKeysOnly

func EtcdGetKeysOnly(prefixString string) ([]string, error)

func EtcdGetPrefix

func EtcdGetPrefix(prefixString string) ([]map[string]string, error)

func EtcdPut

func EtcdPut(keyString string, valueString string) (bool, error)

func EtcdPutWithLeast

func EtcdPutWithLeast(keyString string, valueString string, t int64) (bool, error)

func EtcdWatchOnce

func EtcdWatchOnce(keyString string) (string, string, string)

func EtcdWatchPrefixOnce

func EtcdWatchPrefixOnce(prefixString string) (string, string, string)

func GetPageParams

func GetPageParams(c echo.Context) (int, int)

func InitEtcd3

func InitEtcd3()

Init a global Etcd rpcclient

func InitMysql

func InitMysql()

Init a global DB interface, create a connection pool

func Logger

func Logger() *log.Logger

func MysqlExecute

func MysqlExecute(sqlString string, args ...interface{}) (bool, error)

func MysqlQuery

func MysqlQuery(sqlString string, args ...interface{}) ([]map[string]string, error)

func NewLogger

func NewLogger() *log.Logger

func ParseConfigFile

func ParseConfigFile(filePath *string)

func StampInt64

func StampInt64() int64

func StampNanoInt64

func StampNanoInt64() int64

func StampNanoString

func StampNanoString() string

func StampString

func StampString() string

func StampToString

func StampToString(i int64) string

func StringToStamp

func StringToStamp(s string) int64

Types

type Config

type Config struct {
	Server   ServerConfig
	Database DatabaseConfig
	Redis    RedisConfig
	Etcd     EtcdConfig
}

func GetConfig

func GetConfig() Config

type DatabaseConfig

type DatabaseConfig struct {
	Host     string
	Port     int
	User     string
	Password string
	Db       string
	MaxOpen  int
	MaxIdle  int
}

type EtcdConfig

type EtcdConfig struct {
	Host string
	Port int
}

type PageDataType

type PageDataType struct {
	Total    int         `json:"total"`
	Page     int         `json:"page"`
	PageSize int         `json:"page_size"`
	Pages    int         `json:"pages"`
	Items    interface{} `json:"items"`
}

type RedisConfig

type RedisConfig struct {
	Host     string
	Port     int
	Password string
}

type ResponseType

type ResponseType struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

type ServerConfig

type ServerConfig struct {
	Host       string
	Port       int
	Env        string
	Cron       bool
	GeneralLog string `toml:"general_log"`
	ErrorLog   string `toml:"error_log"`
	AccessLog  string `toml:"access_log"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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