app

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2021 License: MIT Imports: 8 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, v interface{}) 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)

func (App) Start

func (a App) Start(port int) error

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() *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