Categorygithub.com/HiLittleCat/core
modulepackage
0.0.0-20190617062028-9fae4c473012
Repository: https://github.com/hilittlecat/core.git
Documentation: pkg.go.dev

# README

Go服务端HTTP框架

  • koa风格的中间件
  • 路由分组,自定义的分组和单个路由的前置和后置处理
  • 流量限制
  • 优雅重启
  • apidoc接口文档

使用

基于core的种子项目

# Packages

Package httputil provides HTTP utility functions, complementing the most common ones in package net/http.
Package log implements a simple logging package for handlers usage.

# Functions

BeforeRun adds a function that will be triggered just before running the server.
HandlePanic sets the panic handler of the default handlers stack.
NewHandlersStack returns a new NewHandlersStack.
Run starts the server for listening and serving.
SessionInit 初始化并加载session中间件.
SetLog 设置logrus日志配置,logPath参数表示记录日志的路径,logFileName表示日志名称前缀.
Use adds a handler to the default handlers stack.
No description provided by the author
No description provided by the author
No description provided by the author
Requires an IP Address string to be exactly a given validation type (IPv4, IPv6, IPv4MappedIPv6, IPv4CIDR, IPv6CIDR, IPv4MappedIPv6CIDR OR IPAny).
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

No description provided by the author
No description provided by the author
IPv4 (32 chars).
No description provided by the author
IP4-mapped IPv6 (45 chars) , Ex) ::FFFF:129.144.52.38.
No description provided by the author
IPv6(39 chars).
No description provided by the author
No description provided by the author
NORMAL BenchmarkRegex-8 2000000000 0.24 ns/op STRICT BenchmarkLoop-8 2000000000 0.01 ns/op */.
No description provided by the author
NORMAL BenchmarkRegex-8 2000000000 0.24 ns/op STRICT BenchmarkLoop-8 2000000000 0.01 ns/op */.

# Variables

Address is the TCP network address on which the server is listening and serving.
IdleTimeout is the maximum amount of time to wait for the next request when keep-alives are enabled.
ListenLimit Limit the number of outstanding requests.
Log core框架日志.
MaxHeaderBytes Max HTTP Herder size, default is 0, no limit.
MultipartMaxmemoryMb Maximum size of memory that can be used when receiving uploaded files.
OpenCommandLine Open command line params.
Production allows handlers know whether the server is running in a production environment.
ReadTimeout Maximum duration for reading the full request (including body); ns|µs|ms|s|m|h.
Routers create router instance.
Timeout is the duration to allow outstanding requests to survive before forcefully terminating them.
WriteTimeout Maximum duration for writing the full response (including body); ns|µs|ms|s|m|h.

# Structs

BusinessError http.StatusInternalServerError.
Context contains all the data needed during the serving flow, including the standard http.ResponseWriter and *http.Request.
Controller 控制器.
DBError http.StatusInternalServerError.
Requires a Domain string to be exactly.
No description provided by the author
Engine each group has a router engine.
Requires an string to be sanitary file path.
HandlersStack contains a set of handlers.
Requires a string(IP Address) to be within IP Pattern type inclusive.
Length requires an array or string to be exactly a given length.
Requires a MAC Address string to be exactly.
Match requires a string to match a given regex.
No description provided by the author
MaxSize requires an array or string to be at most a given length.
No description provided by the author
MinSize requires an array or string to be at least a given length.
Model model struct.
NotFoundError route not found.
Param is a single URL parameter, consisting of a key and a value.
Requires a string to be without invisible characters.
Range requires an integer to be within Min, Max inclusive.
No description provided by the author
ResFormat response data.
RouterGroup is used internally to configure router, a RouterGroup is associated with a prefix and an array of handlers (middleware).
ServerError http.StatusInternalServerError.
Service service struct.
No description provided by the author
Validation context manages data validation and error message.
ValidationError simple struct to store the Message & Key of a validation error.

# Interfaces

IController 控制器接口定义.
ICoreError core error interface.
IModel model interface.
IProvider 用以表征session管理器底层存储结构.
IRouter router interface.
IRoutes routes interface.
IService service interface.
IStore session操作.
No description provided by the author

# Type aliases

H is a shortcut for map[string]interface{}.
Params is a Param-slice, as returned by the router.
RouterHandler http handler.
RouterHandlerChain http handler array.