httplib

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REMOTE_IP         = "remote_ip"
	RET               = "ret"
	RET_RAW_STR       = "ret_raw_str"
	CODE              = "code"
	ERR               = "err"
	SESSION_LOG_LEVEL = "session_log_level"
	DEBUG             = "debug"
	DATA              = "data"
	DATA_RAW          = "data_raw"
	REDIRECT_URL      = "redirect_url"
	TraceID           = "trace_id"
)

Variables

This section is empty.

Functions

func GlFilter added in v1.6.1

func GlFilter() gin.HandlerFunc

example: use gl

func GroupFilter

func GroupFilter() gin.HandlerFunc

example: group filter

func Logger

func Logger() 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 Wrap

func Wrap(toWrap interface{}) (gin.HandlerFunc, error)

example: warp 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

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

func (*HttpServer) DefaultAddHandler

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

func (*HttpServer) DefaultRegister

func (h *HttpServer) DefaultRegister()

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