application

package
v3.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Dev development environment
	Dev = "dev"
	// Test environment
	Test = "test"
	// Prod production environment
	Prod = "prod"
)

Variables

View Source
var Conf *config

Conf project basic configuration

Functions

func GetConfReader

func GetConfReader() *viper.Viper

GetConfReader Get config reader of the application

func LoadApplicationConfigFile

func LoadApplicationConfigFile(l listener.ConfigListener)

LoadApplicationConfigFile load the application configuration file

Types

type App

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

App application instance

func Default

func Default(listeners ...listener.ApplicationListener) *App

Default Create a default application with gin default logger, exception interception, and cross-domain middleware

func New

func New(listeners []listener.ApplicationListener, middlewares ...gin.HandlerFunc) *App

New Create a clean application, you can add some gin middlewares to the engine

func (*App) Banner

func (a *App) Banner(b string) *App

Banner Sets the project startup banner

func (*App) ExitDelay

func (a *App) ExitDelay(time time.Duration) *App

ExitDelay Graceful exit time(default 3s), when reached to shut down the server and trigger PostStop().

func (*App) Interceptor added in v3.0.1

func (a *App) Interceptor(interceptor ...mvc.MethodInterceptor) *App

Interceptor Add a global interceptor

func (*App) Log added in v3.0.6

func (a *App) Log(collector logger.AbstractLogger) *App

Log Sets the log collector

func (*App) ReadConfig

func (a *App) ReadConfig(v any) *App

ReadConfig Read configuration v config struct pointer

func (*App) ReadConfigSub added in v3.1.0

func (a *App) ReadConfigSub(v any, sub string) *App

ReadConfigSub Read configuration v: config struct pointer sub: sub configuration key

func (*App) Run

func (a *App) Run()

Run the main program entry

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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