sys

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEV = "dev"
	STG = "stg"
	PRD = "prd"
)

Variables

This section is empty.

Functions

func Bool

func Bool(k string) bool

func Config

func Config() *viper.Viper

func DefaultObject

func DefaultObject(k string, def interface{}) interface{}

func Env

func Env() string

func Float

func Float(k string) float64

func Int

func Int(k string) int

func IntSlice

func IntSlice(k string) []int

func Logger

func Logger() *logrus.Logger

func Object

func Object(k string) interface{}

func String

func String(k string) string

func StringMap

func StringMap(k string) map[string]interface{}

func StringMapString

func StringMapString(k string) map[string]string

func StringMapStringSlice

func StringMapStringSlice(k string) map[string][]string

func StringSlice

func StringSlice(k string) []string

Types

type ConfigApp added in v0.1.0

type ConfigApp struct {
	Net ConfigNet `yaml:"net"`
	Log ConfigLog `yaml:"log"`
	Dbs ConfigDbs `yaml:"dbs"`
}

type ConfigDbs added in v0.1.0

type ConfigDbs struct {
	Rdbms ConfigDbsRdbms `yaml:"rdbms"`
	Redis ConfigDbsRedis `yaml:"redis"`
}

type ConfigDbsRdbms added in v0.1.0

type ConfigDbsRdbms struct {
	Kind   string `yaml:"kind"`
	Host   string `yaml:"host"`
	Port   int    `yaml:"port"`
	User   string `yaml:"user"`
	Pass   string `yaml:"pass"`
	Dbname string `yaml:"dbname"`
	Prefix string `yaml:"prefix"`
}

type ConfigDbsRedis added in v0.1.0

type ConfigDbsRedis struct {
	Addr      string `yaml:"addr"`
	Pass      string `yaml:"pass"`
	Index     int    `yaml:"index"`
	Nodes     string `yaml:"nodes"`
	NodesPass string `yaml:"nodes_pass"`
}

type ConfigDefault added in v0.1.0

type ConfigDefault struct {
	App ConfigApp `yaml:"app"`
}

func NewConfigDefault added in v0.1.0

func NewConfigDefault() *ConfigDefault

type ConfigLog added in v0.1.0

type ConfigLog struct {
	Path    string `yaml:"path"`
	File    string `yaml:"file"`
	MaxNum  int    `yaml:"max_num"`
	MaxAge  int    `yaml:"max_age"`
	MaxSize int    `yaml:"max_size"`
}

type ConfigNet added in v0.1.0

type ConfigNet struct {
	Port int `yaml:"port"`
}

type LineFormatter

type LineFormatter struct {
	TimestampFormat string //2006/01/02 15:04:05.000
}

func (*LineFormatter) Format

func (f *LineFormatter) Format(entry *logrus.Entry) ([]byte, error)

Jump to

Keyboard shortcuts

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