web

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Path      = "path"
	Query     = "query"
	Body      = "body"
	Header    = "header"
	Form      = "form"
	Multipart = "multipart"
	Context   = "context"
	Request   = "request"
	Response  = "response"
	Stream    = "stream"
)

Variables

Functions

This section is empty.

Types

type ApiInfo added in v1.3.0

type ApiInfo struct {
	HttpMethod string
	URL        string
	ApiDesc    string
	Params     []Param
}

type Configure added in v1.2.6

type Configure struct {
	bean.Component
	Charset string `yaml:"charset"`
}

func (*Configure) Prefix added in v1.2.6

func (c *Configure) Prefix() string

type Container added in v1.1.5

type Container interface {
	bean.Bean
	RestHandler() RestHandler
	FsHandler() FsHandler
	ListenAndServe(port int)
}

type FS added in v1.3.4

type FS struct{}

type Filter added in v1.1.5

type Filter interface {
	bean.Bean
	Order() int
	UrlPatterns() Patterns
	DoFilter(w http.ResponseWriter, r *http.Request, chain FilterChain) error
}

type FilterChain added in v1.1.8

type FilterChain interface {
	GetFilter() Filter
	SetNext(chain FilterChain)
	GetNext() FilterChain
	DoFilter(w http.ResponseWriter, r *http.Request) error
	SetService(service Service)
	DoService(w http.ResponseWriter, r *http.Request) error
}

type FsHandler added in v1.3.4

type FsHandler func(url, dir string)

type Param added in v1.3.0

type Param struct {
	Name   string
	Source string
	Type   reflect.Type
}

type ParamMapper added in v1.3.0

type ParamMapper interface {
	//PathParamMapper
	GetStringFromPath(param Param) (string, error)
	GetIntFromPath(param Param) (int, error)
	GetBoolFromPath(param Param) (bool, error)
	GetFloatFromPath(param Param) (float64, error)
	//QueryParamMapper
	GetStringFromQuery(param Param) (string, error)
	GetIntFromQuery(param Param) (int, error)
	GetBoolFromQuery(param Param) (bool, error)
	GetFloatFromQuery(param Param) (float64, error)
	GetStructFromQuery(param Param) (interface{}, error)
	//BodyParamMapper
	GetStructFromBody(param Param) (interface{}, error)
	GetMapFromBody(param Param) (interface{}, error)
	//HeaderParamMapper
	GetStringFromHeader(param Param) (string, error)
	//FormParamMapper
	GetStringFromForm(param Param) (string, error)
	GetIntFromForm(param Param) (int, error)
	GetBoolFromForm(param Param) (bool, error)
	GetFloatFromForm(param Param) (float64, error)
	GetMapFromForm() (map[string][]string, error)
	//UploadMapper
	GetStringFromMultipart(param Param) (string, error)
	GetMultipartHeader(param Param) (*multipart.FileHeader, error)
	GetMultipartFile(param Param) (multipart.File, error)
	GetStream() ([]byte, error)
	//HttpMapper
	GetRequest() (*http.Request, error)
	GetResponseWriter() (http.ResponseWriter, error)
	//Context
	GetContext() (context.Context, error)
	//ExtendedParamMapper
	Get(param Param) (interface{}, error)
}

type Patterns added in v1.2.2

type Patterns []string

type Rest added in v1.3.4

type Rest struct{}

type RestHandler added in v1.3.4

type RestHandler func(apiInfo *ApiInfo, svm *ServiceMethod)

type Service added in v1.1.9

type Service func(w http.ResponseWriter, r *http.Request) error

type ServiceMethod added in v1.3.6

type ServiceMethod struct {
	Type  *reflect.Method
	Value *reflect.Value
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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