Documentation
¶
Index ¶
- Variables
- type Command
- type CommandRunner
- type Database
- type Env
- type FxLogger
- type GinLogger
- type GormLogger
- func (gl GormLogger) Error(ctx context.Context, msg string, data ...interface{})
- func (gl GormLogger) Info(ctx context.Context, msg string, data ...interface{})
- func (gl *GormLogger) LogMode(level gorm_logger.LogLevel) gorm_logger.Interface
- func (gl GormLogger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)
- func (gl GormLogger) Warn(ctx context.Context, msg string, data ...interface{})
- type Logger
- type Router
Constants ¶
This section is empty.
Variables ¶
View Source
var Module = fx.Options( fx.Provide(NewDatabase), fx.Provide(NewEnv), fx.Provide(GetLogger), fx.Provide(NewRouter), )
exports libraries dependency
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command interface {
// Short returns string about short description of the command
// the string is shown in help screen of cobra command
Short() string
// Setup is used to setup flags or pre-run steps for the command.
//
// For example,
// cmd.Flags().IntVarP(&r.num, "num", "n", 5, "description")
//
Setup(cmd *cobra.Command)
// Run runs the command runner
// run returns command runner which is a function with dependency
// injected arguments.
//
// For example,
// Command{
// Run: func(l lib.Logger) {
// l.Info("i am working")
// },
// }
//
Run() CommandRunner
}
Command interface is used to implement sub-commands in the system.
type CommandRunner ¶
type CommandRunner interface{}
type Database ¶
func NewDatabase ¶
type Env ¶
type Env struct {
ServerPort string `mapstructure:"SERVER_PORT"`
Environment string `mapstructure:"ENV"`
LogOutput string `mapstructure:"LOG_OUTPUT"`
LogLevel string `mapstructure:"LOG_LEVEL"`
JWTSecret string `mapstructure:"JWT_SECRET"`
PostgresUserName string `mapstructure:"POSTGRES_USER"`
PostgresPassword string `mapstructure:"POSTGRES_PASS"`
PostgresHost string `mapstructure:"POSTGRES_HOST"`
PostgresPort string `mapstructure:"POSTGRES_PORT"`
PostgresDB string `mapstructure:"POSTGRES_DATABASE"`
RedisPassword string `mapstructure:"REDIS_PASS"`
RedisHost string `mapstructure:"REDIS_HOST"`
RedisPort string `mapstructure:"REDIS_PORT"`
RedisName string `mapstructure:"REDIS_NAME"`
}
type FxLogger ¶
type FxLogger struct {
*Logger
}
type GormLogger ¶
type GormLogger struct {
*Logger
gorm_logger.Config
}
func (GormLogger) Error ¶
func (gl GormLogger) Error(ctx context.Context, msg string, data ...interface{})
Error print error messages
func (GormLogger) Info ¶
func (gl GormLogger) Info(ctx context.Context, msg string, data ...interface{})
Info print info messages
func (*GormLogger) LogMode ¶
func (gl *GormLogger) LogMode(level gorm_logger.LogLevel) gorm_logger.Interface
LogMode log mode
type Logger ¶
type Logger struct {
*zap.SugaredLogger
}
func (*Logger) GetFxLogger ¶
GetFxLogger get the fx logger
func (Logger) GetGinLogger ¶
GetGinLogger get the gin logger
func (Logger) GetGormLogger ¶
func (l Logger) GetGormLogger() *GormLogger
GetGormLogger get the gorm logger
Click to show internal directories.
Click to hide internal directories.