sys

package
v0.1.17 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 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 ConfigDefault added in v0.1.14

type ConfigDefault struct {
	Sys   ConfigSys   `toml:"sys"`
	Log   ConfigLog   `toml:"log"`
	Token ConfigToken `toml:"token"`
	Rdbms ConfigRdbms `toml:"rdbms"`
	Redis ConfigRedis `toml:"redis"`
}

ConfigDefault default config

func NewConfigDefault added in v0.1.14

func NewConfigDefault() *ConfigDefault

type ConfigLog added in v0.1.14

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

type ConfigRdbms added in v0.1.17

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

type ConfigRedis added in v0.1.17

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

type ConfigSys added in v0.1.17

type ConfigSys struct {
	Port int `toml:"port"`
}

type ConfigToken added in v0.1.17

type ConfigToken struct {
	Secret  string `toml:"secret"`
	Expires int    `toml:"expires"`
}

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