dhttp

package
v1.6.6 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RemoteIP        = "remote_ip"
	Ret             = "ret"
	RwtRawStr       = "ret_raw_str"
	Code            = "code"
	Err             = "err"
	SessionLogLevel = "session_log_level"
	Debug           = "debug"
	Data            = "data"
	DataRaw         = "data_raw"
	RedirectUrl     = "redirect_url"
	TraceID         = "trace_id"
)

Variables

This section is empty.

Functions

func CheckWrap added in v1.6.5

func CheckWrap(toWrap interface{}) error

func GlFilter

func GlFilter() gin.HandlerFunc

example: use gl

func GroupFilter

func GroupFilter() gin.HandlerFunc

example: group filter

func Logger

func Logger(pk string) gin.HandlerFunc

example: log middle handle

func ParseRet

func ParseRet(c *gin.Context) (ret interface{}, origErr interface{})

func Return

func Return(c *gin.Context, code int, message string, err error, result interface{})

func StatFilter added in v1.6.4

func StatFilter() gin.HandlerFunc

example: stat filter

func Wrap

func Wrap(toWrap interface{}) gin.HandlerFunc

example: wrap to gin.HandlerFunc -- func(*Context)

Types

type HttpClient

type HttpClient struct {
	Timeout time.Duration
	Domain  string
}

func (*HttpClient) Method

func (c *HttpClient) Method(method string, path string, header map[string]string, params interface{}) (*http.Response, string, error)

func (*HttpClient) MethodTimeout

func (c *HttpClient) MethodTimeout(method string, path string, header map[string]string, params interface{}, timeout time.Duration) (*http.Response, string, error)

func (*HttpClient) Start

func (c *HttpClient) Start() error

type HttpServer

type HttpServer struct {
	NoGinLog                  bool
	UseHttps                  bool
	HttpsCertFilePath         string
	HttpsKeyFilePath          string
	HttpServerShutdownTimeout int64
	HttpServerReadTimeout     int64
	HttpServerWriteTimeout    int64
	HttpServerRunHost         string
	HttpServerIniter          HttpServerIniter

	HandlerMap map[string]interface{}
	// contains filtered or unexported fields
}

func (*HttpServer) AddHandler added in v1.6.3

func (h *HttpServer) AddHandler(url string, handle interface{})

func (*HttpServer) CheckHandle added in v1.6.3

func (h *HttpServer) CheckHandle() error

func (*HttpServer) DELETE added in v1.6.3

func (h *HttpServer) DELETE(group *gin.RouterGroup, relativePath string, handler interface{})

func (*HttpServer) GET added in v1.6.3

func (h *HttpServer) GET(group *gin.RouterGroup, relativePath string, handler interface{})

func (*HttpServer) Handle added in v1.6.3

func (h *HttpServer) Handle(group *gin.RouterGroup, httpMethod, relativePath string, handler interface{})

For GET, POST, PUT, PATCH and DELETE requests the respective shortcut functions can be used.

func (*HttpServer) OPTIONS added in v1.6.3

func (h *HttpServer) OPTIONS(group *gin.RouterGroup, relativePath string, handler interface{})

func (*HttpServer) PATCH added in v1.6.3

func (h *HttpServer) PATCH(group *gin.RouterGroup, relativePath string, handler interface{})

func (*HttpServer) POST added in v1.6.3

func (h *HttpServer) POST(group *gin.RouterGroup, relativePath string, handler interface{})

func (*HttpServer) PUT added in v1.6.3

func (h *HttpServer) PUT(group *gin.RouterGroup, relativePath string, handler interface{})

func (*HttpServer) Run

func (h *HttpServer) Run() error

func (*HttpServer) SetInit

func (h *HttpServer) SetInit(i HttpServerIniter)

func (*HttpServer) Stop

func (h *HttpServer) Stop()

type HttpServerIniter

type HttpServerIniter func(g *gin.Engine) error

Jump to

Keyboard shortcuts

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