boot

package
v0.0.0-...-39e3969 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppInfoHeaders

func AppInfoHeaders() gin.HandlerFunc

func Env

func Env() string

func IsDev

func IsDev() bool

func IsProd

func IsProd() bool

func IsTest

func IsTest() bool

Types

type Action

type Action any

type AppHandler

type AppHandler func(app *Application)

type Application

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

func NewApplication

func NewApplication(opts *Options) *Application

func (*Application) Run

func (app *Application) Run()

type ErrorHandler

type ErrorHandler func(ctx *gin.Context, err any)

type GroupRouter

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

func (*GroupRouter) Get

func (g *GroupRouter) Get(path string, action Action)

func (*GroupRouter) Group

func (g *GroupRouter) Group(path string, handlers ...gin.HandlerFunc) *GroupRouter

func (*GroupRouter) Handle

func (g *GroupRouter) Handle(method, path string, action Action)

func (*GroupRouter) Post

func (g *GroupRouter) Post(path string, action Action)

type Options

type Options struct {
	Timeout       time.Duration
	ConfigPaths   []string
	AppBeforeInit AppHandler
	AppAfterInit  AppHandler
	Starters      []abs.IStarter
	ErrorHook     ErrorHandler
	Middlewares   []gin.HandlerFunc
	RouteHook     RouteHandler
}

type Response

type Response struct {
	HC  int         `json:"httpCode"`
	Cd  interface{} `json:"code"`
	Msg string      `json:"message"`
	D   interface{} `json:"data"`
}

func (*Response) Code

func (r *Response) Code(code int) *Response

func (*Response) Data

func (r *Response) Data(data interface{}) *Response

func (*Response) Message

func (r *Response) Message(message string) *Response

type ResponseWriter

type ResponseWriter struct {
	gin.ResponseWriter
	// contains filtered or unexported fields
}

func (ResponseWriter) Write

func (rw ResponseWriter) Write(bs []byte) (int, error)

type RouteHandler

type RouteHandler func(group *GroupRouter)

Jump to

Keyboard shortcuts

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