Versions in this module Expand all Collapse all v1 v1.1.3 Oct 9, 2022 Changes in this version + func Bind(i interface{}, ctx Context) error + func BindForm(i interface{}, ctx Context) error + func BindJSON(i interface{}, ctx Context) error + func BindXML(i interface{}, ctx Context) error + func RegisterBodyBinder(mime string, binder BodyBinder) + func RegisterScopeBinder(scope BindScope, tag string) + type BindScope int + const BindScopeBody + const BindScopeHeader + const BindScopeQuery + const BindScopeURI + type BodyBinder func(i interface{}, ctx Context) error type Filter + func NewGzipFilter(level int) (Filter, error) + type GzipFilter struct + ExcludedExtensions []string + ExcludedPaths []string + ExcludedPathsRegexes []*regexp.Regexp + func (f *GzipFilter) Invoke(ctx Context, chain FilterChain) + type NextOperation int + const Iterative + const Recursive type Router + HttpDelete func(path string, h http.HandlerFunc) *Mapper + HttpGet func(path string, h http.HandlerFunc) *Mapper + HttpPost func(path string, h http.HandlerFunc) *Mapper + HttpPut func(path string, h http.HandlerFunc) *Mapper v1.1.2 Sep 13, 2022 v1.1.1 Aug 26, 2022 Changes in this version type BaseContext + Logger *log.Logger + func (c *BaseContext) Response() Response + func (c *BaseContext) SetContext(ctx context.Context) type Context + Response func() Response + SetContext func(ctx context.Context) + type FileHandler struct + Prefix string + Server http.Handler + func (f *FileHandler) FileLine() (file string, line int, fnName string) + func (f *FileHandler) Invoke(ctx Context) + type Response interface + Get func() http.ResponseWriter + Set func(w http.ResponseWriter) type Server + AccessFilter func() Filter + SetAccessFilter func(filter Filter) + type SimpleResponse struct + func (resp *SimpleResponse) Get() http.ResponseWriter + func (resp *SimpleResponse) Set(w http.ResponseWriter) v1.1.0 Jul 23, 2022 Changes in this version + const AuthUserKey + const CharsetUTF8 + const ContextKey + const DefaultWildcardName + const EchoPathStyle + const GinPathStyle + const HeaderAccept + const HeaderAcceptEncoding + const HeaderAccessControlAllowCredentials + const HeaderAccessControlAllowHeaders + const HeaderAccessControlAllowMethods + const HeaderAccessControlAllowOrigin + const HeaderAccessControlExposeHeaders + const HeaderAccessControlMaxAge + const HeaderAccessControlRequestHeaders + const HeaderAccessControlRequestMethod + const HeaderAllow + const HeaderAuthorization + const HeaderContentDisposition + const HeaderContentEncoding + const HeaderContentLength + const HeaderContentSecurityPolicy + const HeaderContentSecurityPolicyReportOnly + const HeaderContentType + const HeaderCookie + const HeaderIfModifiedSince + const HeaderLastModified + const HeaderLocation + const HeaderOrigin + const HeaderReferrerPolicy + const HeaderServer + const HeaderSetCookie + const HeaderStrictTransportSecurity + const HeaderUpgrade + const HeaderVary + const HeaderWWWAuthenticate + const HeaderXCSRFToken + const HeaderXContentTypeOptions + const HeaderXCorrelationID + const HeaderXForwardedFor + const HeaderXForwardedProto + const HeaderXForwardedProtocol + const HeaderXForwardedSsl + const HeaderXFrameOptions + const HeaderXHTTPMethodOverride + const HeaderXRealIP + const HeaderXRequestID + const HeaderXRequestedWith + const HeaderXUrlScheme + const HeaderXXSSProtection + const JavaPathStyle + const MIMEApplicationForm + const MIMEApplicationJSON + const MIMEApplicationJSONCharsetUTF8 + const MIMEApplicationJavaScript + const MIMEApplicationJavaScriptCharsetUTF8 + const MIMEApplicationMsgpack + const MIMEApplicationProtobuf + const MIMEApplicationXML + const MIMEApplicationXMLCharsetUTF8 + const MIMEImageGif + const MIMEImageJpeg + const MIMEImagePng + const MIMEJsonAPI + const MIMEJsonStream + const MIMEMultipartForm + const MIMEOctetStream + const MIMETextHTML + const MIMETextHTMLCharsetUTF8 + const MIMETextPlain + const MIMETextPlainCharsetUTF8 + const MIMETextXML + const MIMETextXMLCharsetUTF8 + const MethodAny + const MethodConnect + const MethodDelete + const MethodGet + const MethodGetPost + const MethodHead + const MethodOptions + const MethodPatch + const MethodPost + const MethodPut + const MethodTrace + const ReplaySessionID + var DEFAULT = NewErrorCode(math.MaxInt32, "DEFAULT") + var ERROR = NewRpcError(-1, "ERROR") + var RPCInvoke = func(ctx Context, fn func(Context) interface{}) + var SUCCESS = NewRpcSuccess(200, "SUCCESS") + func FuncFilter(f FilterFunc) *funcFilter + func GetHTTPRequest(ctx context.Context) *http.Request + func GetMethod(method uint32) (r []string) + func NewFilterChain(filters []Filter) *filterChain + func NewRouter() *router + func NewServer(config ServerConfig, handler ServerHandler) *server + func RegisterSwaggerHandler(handler SwaggerHandler) + func StartRecord(ctx Context) + func StartReplay(ctx Context) + func StopRecord(ctx Context) + func StopReplay(ctx Context) + func ToPathStyle(path string, style PathStyleEnum) (newPath string, wildcard string) + func URLPatternFilter(f Filter, s ...string) *urlPatternFilter + func URLPatterns(filters []Filter) (*urlPatterns, error) + func WithFileLine(err error, skip int) error + type BaseContext struct + func NewBaseContext(path string, handler Handler, r *http.Request, w ResponseWriter) *BaseContext + func (c *BaseContext) Attachment(file string, name string) + func (c *BaseContext) Bind(i interface{}) error + func (c *BaseContext) Blob(contentType string, b []byte) + func (c *BaseContext) ClientIP() string + func (c *BaseContext) ContentType() string + func (c *BaseContext) Context() context.Context + func (c *BaseContext) Cookie(name string) (*http.Cookie, error) + func (c *BaseContext) Cookies() []*http.Cookie + func (c *BaseContext) File(file string) + func (c *BaseContext) FormFile(name string) (*multipart.FileHeader, error) + func (c *BaseContext) FormParams() (url.Values, error) + func (c *BaseContext) FormValue(name string) string + func (c *BaseContext) Get(key string) interface{} + func (c *BaseContext) HTML(html string) + func (c *BaseContext) HTMLBlob(b []byte) + func (c *BaseContext) Handler() Handler + func (c *BaseContext) Header(key string) string + func (c *BaseContext) Inline(file string, name string) + func (c *BaseContext) IsTLS() bool + func (c *BaseContext) IsWebSocket() bool + func (c *BaseContext) JSON(i interface{}) + func (c *BaseContext) JSONBlob(b []byte) + func (c *BaseContext) JSONP(callback string, i interface{}) + func (c *BaseContext) JSONPBlob(callback string, b []byte) + func (c *BaseContext) JSONPretty(i interface{}, indent string) + func (c *BaseContext) MultipartForm() (*multipart.Form, error) + func (c *BaseContext) NativeContext() interface{} + func (c *BaseContext) NoContent(code int) + func (c *BaseContext) Path() string + func (c *BaseContext) PathParam(name string) string + func (c *BaseContext) PathParamNames() []string + func (c *BaseContext) PathParamValues() []string + func (c *BaseContext) QueryParam(name string) string + func (c *BaseContext) QueryParams() url.Values + func (c *BaseContext) QueryString() string + func (c *BaseContext) Redirect(code int, url string) + func (c *BaseContext) Request() *http.Request + func (c *BaseContext) RequestBody() ([]byte, error) + func (c *BaseContext) ResponseWriter() ResponseWriter + func (c *BaseContext) SSEvent(name string, message interface{}) + func (c *BaseContext) SaveUploadedFile(file *multipart.FileHeader, dst string) error + func (c *BaseContext) Scheme() string + func (c *BaseContext) Set(key string, val interface{}) error + func (c *BaseContext) SetContentType(typ string) + func (c *BaseContext) SetCookie(cookie *http.Cookie) + func (c *BaseContext) SetHeader(key, value string) + func (c *BaseContext) SetStatus(code int) + func (c *BaseContext) String(format string, values ...interface{}) + func (c *BaseContext) XML(i interface{}) + func (c *BaseContext) XMLBlob(b []byte) + func (c *BaseContext) XMLPretty(i interface{}, indent string) + type BasicAuthConfig struct + Accounts map[string]string + Realm string + type BufferedResponseWriter struct + func (w *BufferedResponseWriter) Body() string + func (w *BufferedResponseWriter) Size() int + func (w *BufferedResponseWriter) Status() int + func (w *BufferedResponseWriter) Write(data []byte) (n int, err error) + func (w *BufferedResponseWriter) WriteHeader(code int) + type Context interface + Attachment func(file string, name string) + Bind func(i interface{}) error + Blob func(contentType string, b []byte) + ClientIP func() string + ContentType func() string + Context func() context.Context + Cookie func(name string) (*http.Cookie, error) + Cookies func() []*http.Cookie + File func(file string) + FormFile func(name string) (*multipart.FileHeader, error) + FormParams func() (url.Values, error) + FormValue func(name string) string + Get func(key string) interface{} + HTML func(html string) + HTMLBlob func(b []byte) + Handler func() Handler + Header func(key string) string + Inline func(file string, name string) + IsTLS func() bool + IsWebSocket func() bool + JSON func(i interface{}) + JSONBlob func(b []byte) + JSONP func(callback string, i interface{}) + JSONPBlob func(callback string, b []byte) + JSONPretty func(i interface{}, indent string) + MultipartForm func() (*multipart.Form, error) + NativeContext func() interface{} + NoContent func(code int) + Path func() string + PathParam func(name string) string + PathParamNames func() []string + PathParamValues func() []string + QueryParam func(name string) string + QueryParams func() url.Values + QueryString func() string + Redirect func(code int, url string) + Request func() *http.Request + RequestBody func() ([]byte, error) + ResponseWriter func() ResponseWriter + SSEvent func(name string, message interface{}) + SaveUploadedFile func(file *multipart.FileHeader, dst string) error + Scheme func() string + Set func(key string, val interface{}) error + SetContentType func(typ string) + SetCookie func(cookie *http.Cookie) + SetHeader func(key, value string) + SetStatus func(code int) + String func(format string, values ...interface{}) + XML func(i interface{}) + XMLBlob func(b []byte) + XMLPretty func(i interface{}, indent string) + type ErrorCode struct + Code int32 + Msg string + func NewErrorCode(code int32, msg string) ErrorCode + type ErrorHandler interface + Invoke func(ctx Context, err *HttpError) + type Filter interface + Invoke func(ctx Context, chain FilterChain) + func AccessLog() Filter + func HTTPSNonWWWRedirect(config RedirectConfig) Filter + func HTTPSRedirect(config RedirectConfig) Filter + func HTTPSWWWRedirect(config RedirectConfig) Filter + func HandlerFilter(fn Handler) Filter + func NewBasicAuthFilter(config BasicAuthConfig) Filter + func NewRequestIDFilter(config RequestIDConfig) Filter + func NonWWWRedirect(config RedirectConfig) Filter + func WWWRedirect(config RedirectConfig) Filter + type FilterChain interface + Continue func(ctx Context) + Next func(ctx Context) + type FilterFunc func(ctx Context, chain FilterChain) + type FuncErrorHandler func(ctx Context, err *HttpError) + func (f FuncErrorHandler) Invoke(ctx Context, err *HttpError) + type Handler interface + FileLine func() (file string, line int, fnName string) + Invoke func(Context) + func BIND(fn interface{}) Handler + func FUNC(fn HandlerFunc) Handler + func HTTP(fn http.HandlerFunc) Handler + func WrapF(fn http.HandlerFunc) Handler + func WrapH(h http.Handler) Handler + type HandlerFunc func(Context) + type HttpError struct + Code int + Internal interface{} + Message string + func NewHttpError(code int, message ...string) *HttpError + func (e *HttpError) Error() string + func (e *HttpError) SetInternal(err error) *HttpError + type Mapper struct + func NewMapper(method uint32, path string, h Handler) *Mapper + func (m *Mapper) Handler() Handler + func (m *Mapper) Method() uint32 + func (m *Mapper) Operation(op Operation) + func (m *Mapper) Path() string + type MethodOverrideConfig struct + func NewMethodOverrideConfig() *MethodOverrideConfig + func (config *MethodOverrideConfig) ByFormValue(name string) *MethodOverrideConfig + func (config *MethodOverrideConfig) ByHeader(key string) *MethodOverrideConfig + func (config *MethodOverrideConfig) ByQueryParam(name string) *MethodOverrideConfig + type MethodOverrideGetter func(ctx Context) string + type Operation interface + Process func() error + type PathStyleEnum int + type Prefilter struct + func FuncPrefilter(f FilterFunc) *Prefilter + func NewMethodOverrideFilter(config *MethodOverrideConfig) *Prefilter + func NewPrefilter(f Filter) *Prefilter + func NewRewriteFilter() *Prefilter + type RedirectConfig struct + Code int + func NewRedirectConfig() RedirectConfig + type RequestIDConfig struct + Generator func() string + Header string + func NewRequestIDConfig() RequestIDConfig + type ResponseWriter interface + Body func() string + Size func() int + Status func() int + type Router interface + AddMapper func(m *Mapper) + DeleteBinding func(path string, fn interface{}) *Mapper + DeleteMapping func(path string, fn HandlerFunc) *Mapper + File func(path string, file string) *Mapper + GetBinding func(path string, fn interface{}) *Mapper + GetMapping func(path string, fn HandlerFunc) *Mapper + HandleDelete func(path string, h Handler) *Mapper + HandleGet func(path string, h Handler) *Mapper + HandlePost func(path string, h Handler) *Mapper + HandlePut func(path string, h Handler) *Mapper + HandleRequest func(method uint32, path string, h Handler) *Mapper + Mappers func() []*Mapper + PostBinding func(path string, fn interface{}) *Mapper + PostMapping func(path string, fn HandlerFunc) *Mapper + PutBinding func(path string, fn interface{}) *Mapper + PutMapping func(path string, fn HandlerFunc) *Mapper + RequestBinding func(method uint32, path string, fn interface{}) *Mapper + RequestMapping func(method uint32, path string, fn HandlerFunc) *Mapper + Static func(prefix string, dir string) *Mapper + StaticFS func(prefix string, fs http.FileSystem) *Mapper + type RpcError ErrorCode + func NewRpcError(code int32, msg string) RpcError + func (r RpcError) Error(err error) *RpcResult + func (r RpcError) ErrorWithData(err error, data interface{}) *RpcResult + func (r RpcError) Panic(err error) *util.PanicCond + func (r RpcError) PanicImmediately(err error) + func (r RpcError) Panicf(format string, a ...interface{}) *util.PanicCond + type RpcResult struct + Data interface{} + Err string + type RpcSuccess ErrorCode + func NewRpcSuccess(code int32, msg string) RpcSuccess + func (r RpcSuccess) Data(data interface{}) *RpcResult + type Server interface + AddFilter func(filter ...Filter) + AddPrefilter func(filter ...*Prefilter) + Config func() ServerConfig + ErrorHandler func() ErrorHandler + Filters func() []Filter + LoggerFilter func() Filter + Prefilters func() []*Prefilter + SetErrorHandler func(errHandler ErrorHandler) + SetLoggerFilter func(filter Filter) + Start func() error + Stop func(ctx context.Context) error + Swagger func(swagger Swagger) + type ServerConfig struct + BasePath string + CertFile string + EnableSSL bool + Host string + KeyFile string + Port int + Prefix string + ReadTimeout int + WriteTimeout int + type ServerHandler interface + RecoveryFilter func(errHandler ErrorHandler) Filter + Start func(s Server) error + type Swagger interface + AddPath func(path string, method string, op Operation) + ReadDoc func() string + type SwaggerHandler func(router Router, doc string) v1.1.0-rc4 May 4, 2022 v1.1.0-rc3 Jan 9, 2022 v1.1.0-rc2 Nov 13, 2021 v1.1.0-rc1 Oct 23, 2021 v1.1.0-beta Sep 20, 2021 v1.1.0-alpha Aug 1, 2021