Documentation ¶
Index ¶
- Constants
- Variables
- func AddGetDataToUrl(urlString string, data url.Values) string
- func CloseDB() error
- func DBPoolLogQuery(trace *TraceContext, sqlDb *sql.DB, query string, args ...interface{}) (*sql.Rows, error)
- func Encode(data string) (string, error)
- func GetBoolConf(key string) bool
- func GetConf(key string) interface{}
- func GetConfEnv() string
- func GetConfEnvPath() string
- func GetConfFilePath(fileName string) string
- func GetConfPath(fileName string) string
- func GetDBPool(name string) (*sql.DB, error)
- func GetDurationConf(key string) time.Duration
- func GetFloat64Conf(key string) float64
- func GetGormPool(name string) (*gorm.DB, error)
- func GetIntConf(key string) int
- func GetLocalIPs() (ips []net.IP)
- func GetMd5Hash(text string) string
- func GetStringConf(key string) string
- func GetStringMapConf(key string) map[string]interface{}
- func GetStringMapStringConf(key string) map[string]string
- func GetStringSliceConf(key string) []string
- func GetTimeConf(key string) time.Time
- func GetTraceId() (traceId string)
- func InArrayString(s string, arr []string) bool
- func Init(configPath string) error
- func InitBaseConf(path string) error
- func InitDBPool(path string) error
- func InitModule(configPath string, modules []string) error
- func InitRedisConf(path string) error
- func InitViperConf() error
- func IsSetConf(key string) bool
- func NewSpanId() string
- func ParseConfPath(config string) (err error)
- func ParseConfig(path string, conf interface{}) (err error)
- func ParseServerAddr(serverAddr string) (host, port string)
- func RedisConfDo(trace *TraceContext, name string, commandName string, args ...interface{}) (interface{}, error)
- func RedisConnFactory(name string) (redis.Conn, error)
- func Substr(str string, start int64, end int64) string
- type BaseConf
- type LogConfConsoleWriter
- type LogConfFileWriter
- type LogConfig
- type Logger
- func (l *Logger) Close()
- func (l *Logger) TagDebug(trace *TraceContext, tag string, m map[string]interface{})
- func (l *Logger) TagError(trace *TraceContext, tag string, m map[string]interface{})
- func (l *Logger) TagInfo(trace *TraceContext, tag string, m map[string]interface{})
- func (l *Logger) TagTrace(trace *TraceContext, tag string, m map[string]interface{})
- func (l *Logger) TagWarning(trace *TraceContext, tag string, m map[string]interface{})
- type MySQLConf
- type MysqlMapConf
- type RedisConf
- type RedisMapConf
- type Trace
- type TraceContext
Constants ¶
View Source
const (
TagUndefined = "_undef"
)
Variables ¶
View Source
var ( ConfBase *BaseConf ViperConfMap map[string]*viper.Viper DBMapPool map[string]*sql.DB GORMMapPool map[string]*gorm.DB DBDefaultPool *sql.DB GORMDefaultPool *gorm.DB ConfRedis *RedisConf ConfRedisMap *RedisMapConf )
View Source
var ConfEnv string //配置环境名 dev/debug/test/pro
View Source
var ConfEnvPath string //配置文件夹
View Source
var DateFormat = "2006-01-02"
View Source
var LocalIP = net.ParseIP("127.0.0.1")
View Source
var TimeFormat = "2006-01-02 15:04:05"
View Source
var TimeLocation *time.Location
Functions ¶
func DBPoolLogQuery ¶
func GetConfEnv ¶
func GetConfEnv() string
func GetConfEnvPath ¶
func GetConfEnvPath() string
func GetConfFilePath ¶
func GetConfPath ¶
func GetLocalIPs ¶
func GetMd5Hash ¶
func GetTraceId ¶
func GetTraceId() (traceId string)
func InArrayString ¶
func InitBaseConf ¶
func InitDBPool ¶
func InitRedisConf ¶
func InitViperConf ¶
func InitViperConf() error
func ParseConfPath ¶
func ParseConfig ¶
func ParseServerAddr ¶
func RedisConfDo ¶
func RedisConfDo(trace *TraceContext, name string, commandName string, args ...interface{}) (interface{}, error)
Types ¶
type BaseConf ¶
type LogConfConsoleWriter ¶
type LogConfFileWriter ¶
type LogConfig ¶
type LogConfig struct { Level string `mapstructure:"log_level"` FW LogConfFileWriter `mapstructure:"file_writer"` CW LogConfConsoleWriter `mapstructure:"console_writer"` }
type Logger ¶
type Logger struct { }
var Log *Logger
func (*Logger) TagDebug ¶
func (l *Logger) TagDebug(trace *TraceContext, tag string, m map[string]interface{})
func (*Logger) TagError ¶
func (l *Logger) TagError(trace *TraceContext, tag string, m map[string]interface{})
func (*Logger) TagInfo ¶
func (l *Logger) TagInfo(trace *TraceContext, tag string, m map[string]interface{})
func (*Logger) TagTrace ¶
func (l *Logger) TagTrace(trace *TraceContext, tag string, m map[string]interface{})
func (*Logger) TagWarning ¶
func (l *Logger) TagWarning(trace *TraceContext, tag string, m map[string]interface{})
type MysqlMapConf ¶
type RedisMapConf ¶
type TraceContext ¶
func NewTrace ¶
func NewTrace() *TraceContext
Click to show internal directories.
Click to hide internal directories.