bootstrap

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SilentMode = "silent"
	ErrorMode  = "error"
	WarnMode   = "warn"
	InfoMode   = "info"
)
View Source
const (
	DebugLevel  = "debug"
	InfoLevel   = "info"
	WarnLevel   = "warn"
	ErrorLevel  = "error"
	DPanicLevel = "dpanic"
	PanicLevel  = "panic"
	FatalLevel  = "fatal"
)

Variables

This section is empty.

Functions

func GetConfig

func GetConfig(configFileName string) (*viper.Viper, config.Config)

func GetDb

func GetDb(dbConfig config.Database) *gorm.DB

func GetLogWriter

func GetLogWriter(logFileName string) *lumberjack.Logger

func GinRecovery

func GinRecovery(logger *zap.Logger, stack bool) gin.HandlerFunc

func HasRouter

func HasRouter() bool

func InitConfig

func InitConfig() *global.Application

func InitDb

func InitDb() *global.Application

func InitLog

func InitLog() *global.Application

func InitRedis

func InitRedis() *global.Application

func LoggerMiddleWare

func LoggerMiddleWare(logger *zap.Logger) gin.HandlerFunc

func RealeaseDB

func RealeaseDB()

func Regist

func Regist(opts ...RouteOption)

func SetupRouter

func SetupRouter() *gin.Engine

func UnmarshalConfig

func UnmarshalConfig(v *viper.Viper)

Types

type Application

type Application struct {
	// contains filtered or unexported fields
}

func Default

func Default() *Application

func NewApplication

func NewApplication(engine *gin.Engine, bootOpts []BootOption, startOpts []StartFunc, globalApp *global.Application) *Application

func NewApplicationWithOpts

func NewApplicationWithOpts(opts ...BootOption) *Application

func (*Application) BootOpt

func (app *Application) BootOpt(bootOpts ...BootOption) *Application

func (*Application) BootUp

func (app *Application) BootUp()

func (*Application) Router

func (app *Application) Router(opts ...RouteOption) *Application

func (*Application) StartFunc

func (app *Application) StartFunc(startOpts ...StartFunc) *Application

func (*Application) Use

func (app *Application) Use(middleware ...gin.HandlerFunc) *Application

type BootOption

type BootOption func() *global.Application

type RouteOption

type RouteOption func(*gin.Engine)

type StartFunc

type StartFunc func()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL