app

package
v0.0.0-...-9528f6d Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version = "1.0.0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	Gin           *gin.Engine
	FS            embed.FS
	DB            *db.DB
	Cache         cache.Cache
	Redis         *redis.Redis
	Logger        *logger.Logger
	Translator    ut.Translator
	Lang          *i18n.I18n
	Services      []Service
	Routes        []Route
	Validations   []Validation
	ShutdownFuncs []func()
	Version       string
}

func NewApplication

func NewApplication(fs embed.FS) *Application

NewApplication create a new application

func (*Application) AddService

func (app *Application) AddService(ss ...Service)

AddService add service

func (*Application) AddShutdown

func (app *Application) AddShutdown(fn func())

AddShutdown add shutdown function

func (*Application) AddValidation

func (app *Application) AddValidation(vs ...Validation)

AddValidation add validation

func (*Application) Run

func (app *Application) Run()

Run start application

func (*Application) Shutdown

func (app *Application) Shutdown()

Shutdown shutdown the application

type Route

type Route func(*gin.Engine)

type Service

type Service interface {
	Boot(*Application)
	Register(*Application)
}

type Validation

type Validation func(*validator.Validate, ut.Translator)

Jump to

Keyboard shortcuts

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