router

package
v0.0.0-...-0751618 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderContentType   = "Content-Type"
	MIMEApplicationJson = "application/json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GrpcServer

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

func NewGrpcServer

func NewGrpcServer(registry registry.Registry) *GrpcServer

func (*GrpcServer) Start

func (g *GrpcServer) Start() error

func (*GrpcServer) Stop

func (g *GrpcServer) Stop() error

type Handle

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

func NewHandle

func NewHandle(rw http.ResponseWriter, r *http.Request) *Handle

func (*Handle) FormValue

func (h *Handle) FormValue(key string) string

func (*Handle) Handler

func (h *Handle) Handler() HandlerFunc

func (*Handle) JSON

func (h *Handle) JSON(code int, i interface{})

func (*Handle) Param

func (h *Handle) Param(key string) string

func (*Handle) Reload

func (h *Handle) Reload(rw http.ResponseWriter, r *http.Request)

func (*Handle) Request

func (h *Handle) Request() *http.Request

func (*Handle) Response

func (h *Handle) Response() *Response

func (*Handle) SetRequest

func (h *Handle) SetRequest(req *http.Request)

func (*Handle) SetResponse

func (h *Handle) SetResponse(res *Response)

type Handler

type Handler interface {
	FormValue(key string) string

	Param(key string) string

	JSON(code int, i interface{})

	Reload(rw http.ResponseWriter, r *http.Request)

	Request() *http.Request

	Handler() HandlerFunc
}

type HandlerFunc

type HandlerFunc func(Handler)

type HttpServer

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

func NewHttpServer

func NewHttpServer(registry registry.Registry) *HttpServer

func (*HttpServer) Delete

func (h *HttpServer) Delete(path string, handlerFunc HandlerFunc)

func (*HttpServer) Get

func (h *HttpServer) Get(path string, handlerFunc HandlerFunc)

func (*HttpServer) Head

func (h *HttpServer) Head(path string, handlerFunc HandlerFunc)

func (*HttpServer) Options

func (h *HttpServer) Options(path string, handlerFunc HandlerFunc)

func (*HttpServer) Post

func (h *HttpServer) Post(path string, handlerFunc HandlerFunc)

func (*HttpServer) Put

func (h *HttpServer) Put(path string, handlerFunc HandlerFunc)

func (*HttpServer) ReceiveByID

func (h *HttpServer) ReceiveByID(handler Handler)

func (*HttpServer) ReceiveList

func (h *HttpServer) ReceiveList(handler Handler)

func (*HttpServer) Send

func (h *HttpServer) Send(rw http.ResponseWriter, r *http.Request)

func (*HttpServer) SendWithFile

func (h *HttpServer) SendWithFile(rw http.ResponseWriter, r *http.Request)

func (*HttpServer) ServeHTTP

func (h *HttpServer) ServeHTTP(rw http.ResponseWriter, r *http.Request)

func (*HttpServer) Start

func (h *HttpServer) Start() error

func (*HttpServer) Stop

func (h *HttpServer) Stop() error

type MutlipartController

type MutlipartController struct {
	Reader *multipart.Reader
}

func (*MutlipartController) File

func (m *MutlipartController) File() (*model.File, error)

func (*MutlipartController) Message

func (m *MutlipartController) Message() (*model.Message, error)

type Response

type Response struct {
	Status int
	Writer http.ResponseWriter
}

func NewResponse

func NewResponse(w http.ResponseWriter) *Response

func (*Response) Header

func (r *Response) Header() http.Header

func (*Response) Write

func (r *Response) Write(b []byte)

func (*Response) WriteHeader

func (r *Response) WriteHeader(code int)

type Router

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

func NewRouter

func NewRouter() *Router

func (*Router) Add

func (r *Router) Add(method, path string, handler HandlerFunc)

func (*Router) FindHandle

func (r *Router) FindHandle(method, path string) HandlerFunc

Jump to

Keyboard shortcuts

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