servicehub-providers

module
v0.0.0-...-3a21694 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2021 License: MIT

README

servicehub-providers

useful providers for servicehub

Providers

  • httpserver
  • pprof
  • health
  • i18n

httpserver

http-server ServiceProvider 提供 http 服务器,供其他 Provider 使用。

支持拦截器、多种请求处理器,请求参数返回参数 不分顺序

例子

例子详情

请求参数

支持请求类型:

  • http.ResponseWriter
  • *http.Request
  • httpserver.Context
  • struct or struct Pointer
  • map[string]interface{} or map[string]interface{} Pointer
  • []byte
  • string
  • slice
数据校验

支持结构体数据校验,参考 github.com/go-playground/validator

返回参数

支持返回类型:

  • int 表示 Response Status
  • io.ReadCloser
  • io.Reader
  • interface{}
  • error
拦截器
func(handler func(ctx httpserver.Context) error) func(ctx httpserver.Context) error {
    return handler // 返回新的处理器
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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