mirror

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

README

mirror

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Request        *http.Request
	ResponseWriter http.ResponseWriter
	PathParams     map[string]string

	MatchedRoute   string
	RespData       []byte
	RespStatusCode int
	// contains filtered or unexported fields
}

func (*Context) BindJSON

func (c *Context) BindJSON(val any) error

func (*Context) BindJSONOpt

func (c *Context) BindJSONOpt(val any, useNumber bool, disableUnknown bool) error

func (*Context) FormValue

func (c *Context) FormValue(key string) StringValue

func (*Context) PathValue

func (c *Context) PathValue(key string) StringValue

func (*Context) QueryValue

func (c *Context) QueryValue(key string) StringValue

func (*Context) RespJSON

func (c *Context) RespJSON(status int, val any) error

func (*Context) RespJSONOK

func (c *Context) RespJSONOK(val any) error

type HTTPServer

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

func InitHttpServer

func InitHttpServer(opts ...HTTPServerOption) *HTTPServer

func (*HTTPServer) Connect

func (h *HTTPServer) Connect(path string, handleFunc HandleFunc, mils ...Middleware)

func (*HTTPServer) Delete

func (h *HTTPServer) Delete(path string, handleFunc HandleFunc, mils ...Middleware)

func (*HTTPServer) Get

func (h *HTTPServer) Get(path string, handleFunc HandleFunc, mils ...Middleware)

func (*HTTPServer) Head

func (h *HTTPServer) Head(path string, handleFunc HandleFunc, mils ...Middleware)

func (*HTTPServer) Options

func (h *HTTPServer) Options(path string, handleFunc HandleFunc, mils ...Middleware)

func (*HTTPServer) Patch

func (h *HTTPServer) Patch(path string, handleFunc HandleFunc, mils ...Middleware)

func (*HTTPServer) Post

func (h *HTTPServer) Post(path string, handleFunc HandleFunc, mils ...Middleware)

func (*HTTPServer) Put

func (h *HTTPServer) Put(path string, handleFunc HandleFunc, mils ...Middleware)

func (*HTTPServer) ServeHTTP

func (h *HTTPServer) ServeHTTP(writer http.ResponseWriter, request *http.Request)

处理请求入口

func (*HTTPServer) Start

func (h *HTTPServer) Start(addr string) error

func (*HTTPServer) Trace

func (h *HTTPServer) Trace(path string, handleFunc HandleFunc, mils ...Middleware)

func (*HTTPServer) Use

func (s *HTTPServer) Use(mils ...Middleware)

type HTTPServerOption

type HTTPServerOption func(server *HTTPServer)

func ServerWithMiddleware

func ServerWithMiddleware(mils ...Middleware) HTTPServerOption

type HandleFunc

type HandleFunc func(ctx *Context)

type Middleware

type Middleware func(next HandleFunc) HandleFunc

type Server

type Server interface {
	http.Handler
	Start(addr string) error
	// contains filtered or unexported methods
}

type StringValue

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

func (*StringValue) AsFloat64

func (s *StringValue) AsFloat64() (float64, error)

func (*StringValue) AsInt64

func (s *StringValue) AsInt64() (int64, error)

func (*StringValue) AsUint64

func (s *StringValue) AsUint64() (uint64, error)

Directories

Path Synopsis
middlewares

Jump to

Keyboard shortcuts

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