config

package
v1.8.20220610 Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cols added in v1.8.20210922

func Cols(name string, rowIndex int) []string

func Duration

func Duration(name string, row, col interface{}, def ...time.Duration) (time.Duration, bool)

默认单位秒 120s、120m、120h、120d,分别表示秒,分,时,天

func ExportConfigTable added in v1.8.20220415

func ExportConfigTable(buf []byte) []byte

导出JSON格式配置表

func FilterRows added in v1.4.11

func FilterRows(name string, cols string, vals ...interface{}) []*tableRow

过滤表格行 cols:多个列名。例如col1,col2,col3 cells:过滤的值,对应列

func Float

func Float(name string, row, col interface{}, def ...float64) (float64, bool)

func ForbidWords

func ForbidWords(msg string) string

func Int

func Int(name string, row, col interface{}, def ...int64) (int64, bool)

func IsPart

func IsPart(s string, match interface{}) bool

Deprecated 当前仅支持,分隔符

func JSON

func JSON(v interface{}) *jsonArg

func LoadFile

func LoadFile(path string, conf interface{}) error

func LoadForbidWords

func LoadForbidWords(words []string)

func LoadLocalTables

func LoadLocalTables(fileName string)

加载tables下所有的tbl文件

func LoadTable

func LoadTable(name string, buf []byte) error

func NumRow

func NumRow(name string) int

func ParseTime added in v1.2.0

func ParseTime(s string) (time.Time, error)

func RowId

func RowId(n int) *tableRow

func Rows

func Rows(name string) []*tableRow

func Scan

func Scan(name string, row, colArgs interface{}, args ...interface{}) (int, error)

func String

func String(name string, row, col interface{}, def ...string) (string, bool)

func Time

func Time(name string, row, col interface{}, def ...time.Time) (time.Time, bool)

func ValidateConfigTable added in v1.8.20220415

func ValidateConfigTable(buf []byte) error

校验配置表数据格式有效性

Types

type Env

type Env struct {
	ProductKey  string
	ServerList  []server `xml:"ServerList>Server"`
	LogPath     string   `xml:"Log>Path"`
	LogTag      string   `xml:"Log>Tag"`
	EnableDebug bool     // 开启调试,将输出消息统计日志等
	// contains filtered or unexported fields
}

func Config

func Config() *Env

func (*Env) Path

func (env *Env) Path() string

func (*Env) Server

func (env *Env) Server(name string) server

type Scanner

type Scanner interface {
	Scan(s string) error
}

Jump to

Keyboard shortcuts

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