Documentation ¶
Index ¶
- Constants
- Variables
- func CreateDir(dirs ...string) (err error)
- func DBInsertOne(bean interface{}) error
- func GetWriteSyncer() (zapcore.WriteSyncer, error)
- func GormMysql() *gorm.DB
- func MysqlTables(db *gorm.DB)
- func New(writer Writer, gormWriter logger.Writer, config GormConfig) logger.Interface
- func Parse() error
- func PathExists(path string) (bool, error)
- func ReleaseToken(u models.User) (string, error)
- type ConfigStruct
- type Crontab
- type CustomClaims
- type GormConfig
- type GormLogger
- func (g *GormLogger) Error(ctx context.Context, message string, data ...interface{})
- func (g *GormLogger) Info(ctx context.Context, message string, data ...interface{})
- func (g *GormLogger) LogMode(level logger.LogLevel) logger.Interface
- func (g *GormLogger) Printf(message string, data ...interface{})
- func (g *GormLogger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)
- func (g *GormLogger) Warn(ctx context.Context, message string, data ...interface{})
- type Mysql
- type Redis
- type Server
- type System
- type Writer
- type Zap
Constants ¶
View Source
const ( ConfigEnv = "GVA_CONFIG" ConfigFile = "etc/config.yaml" )
Variables ¶
View Source
var ( Discard = New(log.New(ioutil.Discard, "", log.LstdFlags), log.New(ioutil.Discard, "", log.LstdFlags), GormConfig{}) Default = New(log.New(os.Stdout, "\r\n", log.LstdFlags), log.New(os.Stdout, "\r\n", log.LstdFlags), GormConfig{ SlowThreshold: 200 * time.Millisecond, LogLevel: logger.Warn, Colorful: true, }) Recorder = traceRecorder{Interface: Default, BeginAt: time.Now()} )
Functions ¶
func DBInsertOne ¶
func DBInsertOne(bean interface{}) error
func GetWriteSyncer ¶
func GetWriteSyncer() (zapcore.WriteSyncer, error)
func MysqlTables ¶
func PathExists ¶
Types ¶
type ConfigStruct ¶
type ConfigStruct struct {
LDAP models.LdapSection `yaml:"ldap"`
}
var Config *ConfigStruct
type Crontab ¶
type Crontab struct {
AliYun string `mapstructure:"aliyun" json:"aliyun" yaml:"aliyun"`
}
type CustomClaims ¶
type CustomClaims struct { ID uint Username string NickName string Role string BufferTime int64 jwt.StandardClaims }
func ParseToken ¶
func ParseToken(token string) (*jwt.Token, *CustomClaims, error)
type GormConfig ¶
type GormLogger ¶
type GormLogger struct { Writer GormConfig // contains filtered or unexported fields }
func (*GormLogger) Error ¶
func (g *GormLogger) Error(ctx context.Context, message string, data ...interface{})
func (*GormLogger) Info ¶
func (g *GormLogger) Info(ctx context.Context, message string, data ...interface{})
func (*GormLogger) Printf ¶
func (g *GormLogger) Printf(message string, data ...interface{})
type Mysql ¶
type Mysql struct { Path string `mapstructure:"path" json:"path" yaml:"path"` Config string `mapstructure:"config" json:"config" yaml:"config"` Dbname string `mapstructure:"db-name" json:"dbname" yaml:"db-name"` Username string `mapstructure:"username" json:"username" yaml:"username"` Password string `mapstructure:"password" json:"password" yaml:"password"` MaxIdleConns int `mapstructure:"max-idle-conns" json:"maxIdleConns" yaml:"max-idle-conns"` MaxOpenConns int `mapstructure:"max-open-conns" json:"maxOpenConns" yaml:"max-open-conns"` LogMode bool `mapstructure:"log-mode" json:"logMode" yaml:"log-mode"` LogZap string `mapstructure:"log-zap" json:"logZap" yaml:"log-zap"` }
type Server ¶
type Server struct { Zap Zap `mapstructure:"zap" json:"zap" yaml:"zap"` Mysql Mysql `mapstructure:"mysql" json:"mysql" yaml:"mysql"` Casbin models.Casbin `mapstructure:"casbin" json:"casbin" yaml:"casbin"` System System `mapstructure:"system" json:"system" yaml:"system"` Redis Redis `mapstructure:"redis" json:"redis" yaml:"redis"` Crontab Crontab `mapstructure:"crontab" json:"crontab" yaml:"crontab"` }
type Zap ¶
type Zap struct { Level string `mapstructure:"level" json:"level" yaml:"level"` Format string `mapstructure:"format" json:"format" yaml:"format"` Prefix string `mapstructure:"prefix" json:"prefix" yaml:"prefix"` Director string `mapstructure:"director" json:"director" yaml:"director"` LinkName string `mapstructure:"link-name" json:"linkName" yaml:"link-name"` ShowLine bool `mapstructure:"show-line" json:"showLine" yaml:"showLine"` EncodeLevel string `mapstructure:"encode-level" json:"encodeLevel" yaml:"encode-level"` StacktraceKey string `mapstructure:"stacktrace-key" json:"stacktraceKey" yaml:"stacktrace-key"` LogInConsole bool `mapstructure:"log-in-console" json:"logInConsole" yaml:"log-in-console"` }
Click to show internal directories.
Click to hide internal directories.