dhttp

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2021 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 {
	GinLog                    bool           `inject:"httpServerGinLog" canNil:"true"`
	UseHttps                  bool           `inject:"httpServerUseHttps" canNil:"true"`
	HttpsCertFilePath         string         `inject:"httpServerHttpsCertFile" canNil:"true"`
	HttpsKeyFilePath          string         `inject:"httpServerHttpsKeyFile" canNil:"true"`
	HttpServerShutdownTimeout int64          `inject:"httpServerShutdownTimeout" canNil:"true"`
	HttpServerReadTimeout     int64          `inject:"httpServerReadTimeout" canNil:"true"`
	HttpServerWriteTimeout    int64          `inject:"httpServerWriteTimeout" canNil:"true"`
	HttpServerRunHost         int            `inject:"httpServerRunHost"`
	HttpServerInit            HttpServerInit `inject:"httpServerInit"`

	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) Close added in v1.7.2

func (h *HttpServer) Close()

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) SetInit

func (h *HttpServer) SetInit(i HttpServerInit)

func (*HttpServer) Start added in v1.7.2

func (h *HttpServer) Start() error

type HttpServerInit added in v1.7.2

type HttpServerInit func(g *gin.Engine) error

Jump to

Keyboard shortcuts

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