Documentation ¶
Index ¶
- Variables
- type Command
- type CommandRunner
- type Database
- type Env
- type FxLogger
- type GinLogger
- type GormLogger
- func (l *GormLogger) Error(ctx context.Context, str string, args ...interface{})
- func (l *GormLogger) Info(ctx context.Context, str string, args ...interface{})
- func (l *GormLogger) LogMode(level gormlogger.LogLevel) gormlogger.Interface
- func (l *GormLogger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)
- func (l *GormLogger) Warn(ctx context.Context, str string, args ...interface{})
- type ImageKit
- type Logger
- type RequestHandler
- type Validator
Constants ¶
This section is empty.
Variables ¶
View Source
var Module = fx.Options( fx.Provide(NewRequestHandler), fx.Provide(NewEnv), fx.Provide(GetLogger), fx.Provide(NewDatabase), fx.Provide(NewValidator), fx.Provide(NewImageKit), )
Module exports 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 Env ¶
type Env struct { ServerPort string `mapstructure:"SERVER_PORT"` Environment string `mapstructure:"ENV"` LogOutput string `mapstructure:"LOG_OUTPUT"` LogLevel string `mapstructure:"LOG_LEVEL"` DBUsername string `mapstructure:"DB_USER"` DBPassword string `mapstructure:"DB_PASS"` DBHost string `mapstructure:"DB_HOST"` DBPort string `mapstructure:"DB_PORT"` DBName string `mapstructure:"DB_NAME"` SmtpUser string `mapstructure:"SMTP_USER"` SmtpPassword string `mapstructure:"SMTP_PASS"` SmtpHost string `mapstructure:"SMTP_HOST"` IkPublicKey string `mapstructure:"IK_PUBLIC_KEY"` IkPrivateKey string `mapstructure:"IK_PRIVATE_KEY"` IkUrlEndpoint string `mapstructure:"IK_URL_ENDPOINT"` JWTSecret string `mapstructure:"JWT_SECRET"` AccessTokenExpiresIn time.Duration `mapstructure:"ACCESS_TOKEN_EXPIRED_IN"` RefreshTokenExpiresIn time.Duration `mapstructure:"REFRESH_TOKEN_EXPIRED_IN"` EmailVerificationExpiresIn time.Duration `mapstructure:"EMAIL_VERIFICATION_EXPIRED_IN"` }
Env has environment stored
type FxLogger ¶
type FxLogger struct {
*Logger
}
type GormLogger ¶
type GormLogger struct { *Logger gormlogger.Config }
func (*GormLogger) Error ¶
func (l *GormLogger) Error(ctx context.Context, str string, args ...interface{})
Error prints error messages
func (*GormLogger) Info ¶
func (l *GormLogger) Info(ctx context.Context, str string, args ...interface{})
Info prints info
func (*GormLogger) LogMode ¶
func (l *GormLogger) LogMode(level gormlogger.LogLevel) gormlogger.Interface
LogMode set log mode
type Logger ¶
type Logger struct {
*zap.SugaredLogger
}
Logger structure
func (*Logger) GetFxLogger ¶
GetFxLogger gets logger for go-fx
func (*Logger) GetGinLogger ¶
GetGinLogger get the gin logger
func (*Logger) GetGormLogger ¶
func (l *Logger) GetGormLogger() *GormLogger
GetGormLogger gets the gorm framework logger
type RequestHandler ¶
RequestHandler function
func NewRequestHandler ¶
func NewRequestHandler(logger *Logger) *RequestHandler
NewRequestHandler creates a new request handler
type Validator ¶
type Validator struct {
*validator.Validate
}
func NewValidator ¶
func NewValidator() *Validator
Click to show internal directories.
Click to hide internal directories.