springweb

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CorsFilter = defaultCorsFilter
View Source
var SessionFilter = defaultSessionFilter
View Source
var StaticFilter = defaultStaticFilter
View Source
var WebInvoke = defaultWebInvoke

WebInvoke 可自定义的 web 执行函数

Functions

func BIND

func BIND(fn interface{}) SpringWeb.Handler

BIND 转换成 BIND 形式的 Web 处理接口

func GetSession

func GetSession(ctx SpringWeb.WebContext) sessions.Session

func RegisterResultHandler added in v0.0.8

func RegisterResultHandler(handler ResultHandler)

func RegisterResultHandlerFunc added in v0.0.8

func RegisterResultHandlerFunc(handler ResultHandlerFunc)

Types

type Param

type Param struct {
	Type      reflect.Type
	ParamType ParamType
}

func NewParam

func NewParam(typ reflect.Type) Param

type ParamType

type ParamType uint
const (
	ParamInvalid ParamType = iota
	ParamStruct
	ParamOther
	ParamContext
	ParamWebContext
	ParamJsonStruct
	ParamFormStruct
	ParamUriStruct
	ParamQueryStruct
	ParamHeaderStruct
)

type ResultHandler added in v0.0.8

type ResultHandler interface {
	Invoke(result []interface{}) []interface{}
}

type ResultHandlerFunc added in v0.0.8

type ResultHandlerFunc func(result []interface{}) []interface{}

func (ResultHandlerFunc) Invoke added in v0.0.8

func (f ResultHandlerFunc) Invoke(result []interface{}) []interface{}

type WebCorsConfig

type WebCorsConfig struct {
	Enable bool   `value:"${web.server.cors.enable:=true}"` //是否启用 Cors
	Origin string `value:"${web.server.cors.origin:=}"`     //授权的跨域地址
}

type WebSessionConfig

type WebSessionConfig struct {
	Enable    bool   `value:"${web.server.session.enable:=true}"`                              //是否启用 Session
	SecretKey string `value:"${web.server.session.secret_key:=github.com/LonelyPale/goutils}"` //加密密钥
	Name      string `value:"${web.server.session.name:=s}"`                                   //cookie 属性名
}

type WebStaticConfig

type WebStaticConfig struct {
	Enable              bool   `value:"${web.server.static.enable:=false}"`                //是否启用 Static 静态目录
	URLPrefix           string `value:"${web.server.static.url_prefix:=/static}"`          //url prefix
	LocalPath           string `value:"${web.server.static.local_path:=./static}"`         //目录路径
	AllowDirectoryIndex bool   `value:"${web.server.static.allow_directory_index:=false}"` //是否允许目录索引
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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