app

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CmnRtn

func CmnRtn(code int, msg string, v interface{}) gin.H

func ErrRtn

func ErrRtn(msg string) gin.H

func OkRtn

func OkRtn(v interface{}) gin.H

func SendJson

func SendJson(c *gin.Context, v interface{})

Types

type App

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

func NewApp

func NewApp(opts ...InfoOpt) *App

func (*App) AddCommand

func (a *App) AddCommand(cmd ...*cobra.Command)

func (*App) Cors

func (a *App) Cors(opts ...CorsOpt) *App

func (*App) Execute added in v0.1.0

func (a *App) Execute(run func(cmd *cobra.Command, args []string))

func (*App) Mdw added in v0.1.2

func (a *App) Mdw(f func(app *App)) *App

func (*App) Mount added in v0.0.2

func (a *App) Mount(f func(app *App)) *App

type Context

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

func NewContext

func NewContext(context *gin.Context) *Context

type CorsOpt

type CorsOpt func(*cors.Config)

func SetCredentials

func SetCredentials(b bool) CorsOpt

func SetExposeHeaders

func SetExposeHeaders(s []string) CorsOpt

func SetHeaders

func SetHeaders(s []string) CorsOpt

func SetMaxAge

func SetMaxAge(age time.Duration) CorsOpt

func SetMethods

func SetMethods(s []string) CorsOpt

func SetOrigin

func SetOrigin(s []string) CorsOpt

func SetOriginFun

func SetOriginFun(f func(origin string) bool) CorsOpt

type Engine

type Engine struct {
	*gin.Engine
}

func NewEngine

func NewEngine(mode string) *Engine

type H

type H gin.H

type Info

type Info struct {
	Use   string
	Short string
	Long  string

	//app mode
	Mode string
}

type InfoOpt

type InfoOpt func(*Info)

func SetLong

func SetLong(l string) InfoOpt

func SetMode

func SetMode(s string) InfoOpt

func SetShort

func SetShort(s string) InfoOpt

func SetUse

func SetUse(u string) InfoOpt

Jump to

Keyboard shortcuts

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