Versions in this module Expand all Collapse all v1 v1.0.2 Oct 28, 2022 Changes in this version + const AuthUserKey + const BindKey + const BodyBytesKey + const DebugMode + const EnvGinMode + const MIMEHTML + const MIMEJSON + const MIMEMultipartPOSTForm + const MIMEPOSTForm + const MIMEPlain + const MIMEXML + const MIMEXML2 + const MIMEYAML + const ReleaseMode + const TestMode + const Version + var DebugPrintRouteFunc func(httpMethod, absolutePath, handlerName string, nuHandlers int) + var DefaultErrorWriter io.Writer = os.Stderr + var DefaultWriter io.Writer = os.Stdout + func CreateTestContext(w http.ResponseWriter) (c *Context, r *Engine) + func Dir(root string, listDirectory bool) http.FileSystem + func DisableBindValidation() + func DisableConsoleColor() + func EnableJsonDecoderDisallowUnknownFields() + func EnableJsonDecoderUseNumber() + func ForceConsoleColor() + func IsDebugging() bool + func Mode() string + func SetMode(value string) + type Accounts map[string]string + type Context struct + Accepted []string + Errors errorMsgs + Keys map[string]interface{} + Params Params + Request *http.Request + Writer ResponseWriter + func (c *Context) Abort() + func (c *Context) AbortWithError(code int, err error) *Error + func (c *Context) AbortWithStatus(code int) + func (c *Context) AbortWithStatusJSON(code int, jsonObj interface{}) + func (c *Context) AsciiJSON(code int, obj interface{}) + func (c *Context) Bind(obj interface{}) error + func (c *Context) BindHeader(obj interface{}) error + func (c *Context) BindJSON(obj interface{}) error + func (c *Context) BindQuery(obj interface{}) error + func (c *Context) BindUri(obj interface{}) error + func (c *Context) BindWith(obj interface{}, b binding.Binding) error + func (c *Context) BindXML(obj interface{}) error + func (c *Context) BindYAML(obj interface{}) error + func (c *Context) ClientIP() string + func (c *Context) ContentType() string + func (c *Context) Cookie(name string) (string, error) + func (c *Context) Copy() *Context + func (c *Context) Data(code int, contentType string, data []byte) + func (c *Context) DataFromReader(code int, contentLength int64, contentType string, reader io.Reader, ...) + func (c *Context) Deadline() (deadline time.Time, ok bool) + func (c *Context) DefaultPostForm(key, defaultValue string) string + func (c *Context) DefaultQuery(key, defaultValue string) string + func (c *Context) Done() <-chan struct{} + func (c *Context) Err() error + func (c *Context) Error(err error) *Error + func (c *Context) File(filepath string) + func (c *Context) FileAttachment(filepath, filename string) + func (c *Context) FileFromFS(filepath string, fs http.FileSystem) + func (c *Context) FormFile(name string) (*multipart.FileHeader, error) + func (c *Context) FullPath() string + func (c *Context) Get(key string) (value interface{}, exists bool) + func (c *Context) GetBool(key string) (b bool) + func (c *Context) GetDuration(key string) (d time.Duration) + func (c *Context) GetFloat64(key string) (f64 float64) + func (c *Context) GetHeader(key string) string + func (c *Context) GetInt(key string) (i int) + func (c *Context) GetInt64(key string) (i64 int64) + func (c *Context) GetPostForm(key string) (string, bool) + func (c *Context) GetPostFormArray(key string) ([]string, bool) + func (c *Context) GetPostFormMap(key string) (map[string]string, bool) + func (c *Context) GetQuery(key string) (string, bool) + func (c *Context) GetQueryArray(key string) ([]string, bool) + func (c *Context) GetQueryMap(key string) (map[string]string, bool) + func (c *Context) GetRawData() ([]byte, error) + func (c *Context) GetString(key string) (s string) + func (c *Context) GetStringMap(key string) (sm map[string]interface{}) + func (c *Context) GetStringMapString(key string) (sms map[string]string) + func (c *Context) GetStringMapStringSlice(key string) (smss map[string][]string) + func (c *Context) GetStringSlice(key string) (ss []string) + func (c *Context) GetTime(key string) (t time.Time) + func (c *Context) GetUint(key string) (ui uint) + func (c *Context) GetUint64(key string) (ui64 uint64) + func (c *Context) HTML(code int, name string, obj interface{}) + func (c *Context) Handler() HandlerFunc + func (c *Context) HandlerName() string + func (c *Context) HandlerNames() []string + func (c *Context) Header(key, value string) + func (c *Context) IndentedJSON(code int, obj interface{}) + func (c *Context) IsAborted() bool + func (c *Context) IsWebsocket() bool + func (c *Context) JSON(code int, obj interface{}) + func (c *Context) JSONP(code int, obj interface{}) + func (c *Context) MultipartForm() (*multipart.Form, error) + func (c *Context) MustBindWith(obj interface{}, b binding.Binding) error + func (c *Context) MustGet(key string) interface{} + func (c *Context) MustMakeApp() contract.App + func (c *Context) MustMakeConfig() contract.Config + func (c *Context) MustMakeKernel() contract.Kernel + func (c *Context) MustMakeLog() contract.Log + func (c *Context) Negotiate(code int, config Negotiate) + func (c *Context) NegotiateFormat(offered ...string) string + func (c *Context) Next() + func (c *Context) Param(key string) string + func (c *Context) PostForm(key string) string + func (c *Context) PostFormArray(key string) []string + func (c *Context) PostFormMap(key string) map[string]string + func (c *Context) ProtoBuf(code int, obj interface{}) + func (c *Context) PureJSON(code int, obj interface{}) + func (c *Context) Query(key string) string + func (c *Context) QueryArray(key string) []string + func (c *Context) QueryMap(key string) map[string]string + func (c *Context) Redirect(code int, location string) + func (c *Context) RemoteIP() (net.IP, bool) + func (c *Context) Render(code int, r render.Render) + func (c *Context) SSEvent(name string, message interface{}) + func (c *Context) SaveUploadedFile(file *multipart.FileHeader, dst string) error + func (c *Context) SecureJSON(code int, obj interface{}) + func (c *Context) Set(key string, value interface{}) + func (c *Context) SetAccepted(formats ...string) + func (c *Context) SetCookie(name, value string, maxAge int, path, domain string, secure, httpOnly bool) + func (c *Context) SetSameSite(samesite http.SameSite) + func (c *Context) ShouldBind(obj interface{}) error + func (c *Context) ShouldBindBodyWith(obj interface{}, bb binding.BindingBody) (err error) + func (c *Context) ShouldBindHeader(obj interface{}) error + func (c *Context) ShouldBindJSON(obj interface{}) error + func (c *Context) ShouldBindQuery(obj interface{}) error + func (c *Context) ShouldBindUri(obj interface{}) error + func (c *Context) ShouldBindWith(obj interface{}, b binding.Binding) error + func (c *Context) ShouldBindXML(obj interface{}) error + func (c *Context) ShouldBindYAML(obj interface{}) error + func (c *Context) Status(code int) + func (c *Context) Stream(step func(w io.Writer) bool) bool + func (c *Context) String(code int, format string, values ...interface{}) + func (c *Context) Value(key interface{}) interface{} + func (c *Context) XML(code int, obj interface{}) + func (c *Context) YAML(code int, obj interface{}) + func (ctx *Context) BaseContext() context.Context + func (ctx *Context) DefaultForm(key string) interface{} + func (ctx *Context) DefaultFormBool(key string, def bool) (bool, bool) + func (ctx *Context) DefaultFormFloat32(key string, def float32) (float32, bool) + func (ctx *Context) DefaultFormFloat64(key string, def float64) (float64, bool) + func (ctx *Context) DefaultFormInt64(key string, def int64) (int64, bool) + func (ctx *Context) DefaultFormStringSlice(key string, def []string) ([]string, bool) + func (ctx *Context) DefaultParamBool(key string, def bool) (bool, bool) + func (ctx *Context) DefaultParamFloat32(key string, def float32) (float32, bool) + func (ctx *Context) DefaultParamFloat64(key string, def float64) (float64, bool) + func (ctx *Context) DefaultParamInt(key string, def int) (int, bool) + func (ctx *Context) DefaultParamInt64(key string, def int64) (int64, bool) + func (ctx *Context) DefaultParamString(key string, def string) (string, bool) + func (ctx *Context) DefaultQueryBool(key string, def bool) (bool, bool) + func (ctx *Context) DefaultQueryFloat32(key string, def float32) (float32, bool) + func (ctx *Context) DefaultQueryFloat64(key string, def float64) (float64, bool) + func (ctx *Context) DefaultQueryInt(key string, def int) (int, bool) + func (ctx *Context) DefaultQueryInt64(key string, def int64) (int64, bool) + func (ctx *Context) DefaultQueryString(key string, def string) (string, bool) + func (ctx *Context) DefaultQueryStringSlice(key string, def []string) ([]string, bool) + func (ctx *Context) FormAll() map[string][]string + func (ctx *Context) HeroParam(key string) interface{} + func (ctx *Context) IHtml(file string, obj interface{}) IResponse + func (ctx *Context) IJson(obj interface{}) IResponse + func (ctx *Context) IJsonp(obj interface{}) IResponse + func (ctx *Context) IRedirect(path string) IResponse + func (ctx *Context) ISetCookie(key string, val string, maxAge int, path string, domain string, secure bool, ...) IResponse + func (ctx *Context) ISetHeader(key string, val string) IResponse + func (ctx *Context) ISetOkStatus() IResponse + func (ctx *Context) ISetStatus(code int) IResponse + func (ctx *Context) IText(format string, values ...interface{}) IResponse + func (ctx *Context) IXml(obj interface{}) IResponse + func (ctx *Context) Make(key string) (interface{}, error) + func (ctx *Context) MakeNew(key string, params []interface{}) (interface{}, error) + func (ctx *Context) MustMake(key string) interface{} + func (ctx *Context) QueryAll() map[string][]string + type Engine struct + AppEngine bool + ForwardedByClientIP bool + FuncMap template.FuncMap + HTMLRender render.HTMLRender + HandleMethodNotAllowed bool + MaxMultipartMemory int64 + RedirectFixedPath bool + RedirectTrailingSlash bool + RemoteIPHeaders []string + RemoveExtraSlash bool + TrustedProxies []string + UnescapePathValues bool + UseRawPath bool + func Default() *Engine + func New() *Engine + func (engine *Engine) Bind(provider framework.ServiceProvider) error + func (engine *Engine) Delims(left, right string) *Engine + func (engine *Engine) GetContainer() framework.Container + func (engine *Engine) HandleContext(c *Context) + func (engine *Engine) IsBind(key string) bool + func (engine *Engine) LoadHTMLFiles(files ...string) + func (engine *Engine) LoadHTMLGlob(pattern string) + func (engine *Engine) NoMethod(handlers ...HandlerFunc) + func (engine *Engine) NoRoute(handlers ...HandlerFunc) + func (engine *Engine) Routes() (routes RoutesInfo) + func (engine *Engine) Run(addr ...string) (err error) + func (engine *Engine) RunFd(fd int) (err error) + func (engine *Engine) RunListener(listener net.Listener) (err error) + func (engine *Engine) RunTLS(addr, certFile, keyFile string) (err error) + func (engine *Engine) RunUnix(file string) (err error) + func (engine *Engine) SecureJsonPrefix(prefix string) *Engine + func (engine *Engine) ServeHTTP(w http.ResponseWriter, req *http.Request) + func (engine *Engine) SetContainer(container framework.Container) + func (engine *Engine) SetFuncMap(funcMap template.FuncMap) + func (engine *Engine) SetHTMLTemplate(templ *template.Template) + func (engine *Engine) Use(middleware ...HandlerFunc) IRoutes + type Error struct + Err error + Meta interface{} + Type ErrorType + func (msg *Error) IsType(flags ErrorType) bool + func (msg *Error) JSON() interface{} + func (msg *Error) MarshalJSON() ([]byte, error) + func (msg *Error) SetMeta(data interface{}) *Error + func (msg *Error) SetType(flags ErrorType) *Error + func (msg *Error) Unwrap() error + func (msg Error) Error() string + type ErrorType uint64 + const ErrorTypeAny + const ErrorTypeBind + const ErrorTypeNu + const ErrorTypePrivate + const ErrorTypePublic + const ErrorTypeRender + type H map[string]interface + func (h H) MarshalXML(e *xml.Encoder, start xml.StartElement) error + type HandlerFunc func(*Context) + func BasicAuth(accounts Accounts) HandlerFunc + func BasicAuthForRealm(accounts Accounts, realm string) HandlerFunc + func Bind(val interface{}) HandlerFunc + func CustomRecovery(handle RecoveryFunc) HandlerFunc + func CustomRecoveryWithWriter(out io.Writer, handle RecoveryFunc) HandlerFunc + func ErrorLogger() HandlerFunc + func ErrorLoggerT(typ ErrorType) HandlerFunc + func Logger() HandlerFunc + func LoggerWithConfig(conf LoggerConfig) HandlerFunc + func LoggerWithFormatter(f LogFormatter) HandlerFunc + func LoggerWithWriter(out io.Writer, notlogged ...string) HandlerFunc + func Recovery() HandlerFunc + func RecoveryWithWriter(out io.Writer, recovery ...RecoveryFunc) HandlerFunc + func WrapF(f http.HandlerFunc) HandlerFunc + func WrapH(h http.Handler) HandlerFunc + type HandlersChain []HandlerFunc + func (c HandlersChain) Last() HandlerFunc + type IRequest interface + BindJson func(obj interface{}) error + BindXml func(obj interface{}) error + ClientIp func() string + Cookie func(key string) (string, bool) + Cookies func() map[string]string + DefaultForm func(key string) interface{} + DefaultFormBool func(key string, def bool) (bool, bool) + DefaultFormFile func(key string) (*multipart.FileHeader, error) + DefaultFormFloat32 func(key string, def float32) (float32, bool) + DefaultFormFloat64 func(key string, def float64) (float64, bool) + DefaultFormInt func(key string, def int) (int, bool) + DefaultFormInt64 func(key string, def int64) (int64, bool) + DefaultFormString func(key string, def string) (string, bool) + DefaultFormStringSlice func(key string, def []string) ([]string, bool) + DefaultParam func(key string) interface{} + DefaultParamBool func(key string, def bool) (bool, bool) + DefaultParamFloat32 func(key string, def float32) (float32, bool) + DefaultParamFloat64 func(key string, def float64) (float64, bool) + DefaultParamInt func(key string, def int) (int, bool) + DefaultParamInt64 func(key string, def int64) (int64, bool) + DefaultParamString func(key string, def string) (string, bool) + DefaultQueryBool func(key string, def bool) (bool, bool) + DefaultQueryFloat32 func(key string, def float32) (float32, bool) + DefaultQueryFloat64 func(key string, def float64) (float64, bool) + DefaultQueryInt func(key string, def int) (int, bool) + DefaultQueryInt64 func(key string, def int64) (int64, bool) + DefaultQueryString func(key string, def string) (string, bool) + DefaultQueryStringSlice func(key string, def []string) ([]string, bool) + GetRawData func() ([]byte, error) + Header func(key string) (string, bool) + Headers func() map[string]string + Host func() string + Method func() string + Uri func() string + type IResponse interface + IHtml func(template string, obj interface{}) IResponse + IJson func(obj interface{}) IResponse + IJsonp func(obj interface{}) IResponse + IRedirect func(path string) IResponse + ISetCookie func(key string, val string, maxAge int, path, domain string, secure, httpOnly bool) IResponse + ISetHeader func(key string, val string) IResponse + ISetOkStatus func() IResponse + ISetStatus func(code int) IResponse + IText func(format string, values ...interface{}) IResponse + IXml func(obj interface{}) IResponse + type IRouter interface + Group func(string, ...HandlerFunc) *RouterGroup + type IRoutes interface + Any func(string, ...HandlerFunc) IRoutes + DELETE func(string, ...HandlerFunc) IRoutes + GET func(string, ...HandlerFunc) IRoutes + HEAD func(string, ...HandlerFunc) IRoutes + Handle func(string, string, ...HandlerFunc) IRoutes + OPTIONS func(string, ...HandlerFunc) IRoutes + PATCH func(string, ...HandlerFunc) IRoutes + POST func(string, ...HandlerFunc) IRoutes + PUT func(string, ...HandlerFunc) IRoutes + Static func(string, string) IRoutes + StaticFS func(string, http.FileSystem) IRoutes + StaticFile func(string, string) IRoutes + Use func(...HandlerFunc) IRoutes + type LogFormatter func(params LogFormatterParams) string + type LogFormatterParams struct + BodySize int + ClientIP string + ErrorMessage string + Keys map[string]interface{} + Latency time.Duration + Method string + Path string + Request *http.Request + StatusCode int + TimeStamp time.Time + func (p *LogFormatterParams) IsOutputColor() bool + func (p *LogFormatterParams) MethodColor() string + func (p *LogFormatterParams) ResetColor() string + func (p *LogFormatterParams) StatusCodeColor() string + type LoggerConfig struct + Formatter LogFormatter + Output io.Writer + SkipPaths []string + type Negotiate struct + Data interface{} + HTMLData interface{} + HTMLName string + JSONData interface{} + Offered []string + XMLData interface{} + YAMLData interface{} + type Param struct + Key string + Value string + type Params []Param + func (ps Params) ByName(name string) (va string) + func (ps Params) Get(name string) (string, bool) + type RecoveryFunc func(c *Context, err interface{}) + type ResponseWriter interface + Pusher func() http.Pusher + Size func() int + Status func() int + WriteHeaderNow func() + WriteString func(string) (int, error) + Written func() bool + type RouteInfo struct + Handler string + HandlerFunc HandlerFunc + Method string + Path string + type RouterGroup struct + Handlers HandlersChain + func (group *RouterGroup) Any(relativePath string, handlers ...HandlerFunc) IRoutes + func (group *RouterGroup) BasePath() string + func (group *RouterGroup) DELETE(relativePath string, handlers ...HandlerFunc) IRoutes + func (group *RouterGroup) GET(relativePath string, handlers ...HandlerFunc) IRoutes + func (group *RouterGroup) Group(relativePath string, handlers ...HandlerFunc) *RouterGroup + func (group *RouterGroup) HEAD(relativePath string, handlers ...HandlerFunc) IRoutes + func (group *RouterGroup) Handle(httpMethod, relativePath string, handlers ...HandlerFunc) IRoutes + func (group *RouterGroup) OPTIONS(relativePath string, handlers ...HandlerFunc) IRoutes + func (group *RouterGroup) PATCH(relativePath string, handlers ...HandlerFunc) IRoutes + func (group *RouterGroup) POST(relativePath string, handlers ...HandlerFunc) IRoutes + func (group *RouterGroup) PUT(relativePath string, handlers ...HandlerFunc) IRoutes + func (group *RouterGroup) Static(relativePath, root string) IRoutes + func (group *RouterGroup) StaticFS(relativePath string, fs http.FileSystem) IRoutes + func (group *RouterGroup) StaticFile(relativePath, filepath string) IRoutes + func (group *RouterGroup) Use(middleware ...HandlerFunc) IRoutes + type RoutesInfo []RouteInfo