Versions in this module Expand all Collapse all v1 v1.0.4 Dec 2, 2023 v1.0.3 Nov 26, 2023 v1.0.2 Nov 26, 2023 v1.0.1 Nov 25, 2023 v0 v0.0.4 Oct 19, 2023 v0.0.3 Sep 24, 2023 v0.0.2 Sep 24, 2023 v0.0.1 Sep 24, 2023 Changes in this version + const AuthUserKey + const BindKey + const BodyBytesKey + const ContextKey + const DebugMode + const EnvGinMode + const MIMEHTML + const MIMEJSON + const MIMEMultipartPOSTForm + const MIMEPOSTForm + const MIMEPlain + const MIMETOML + const MIMEXML + const MIMEXML2 + const MIMEYAML + const PlatformCloudflare + const PlatformGoogleAppEngine + 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]any + Params Params + Request *http.Request + Writer ResponseWriter + func CreateTestContextOnly(w http.ResponseWriter, r *Engine) (c *Context) + 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 any) + func (c *Context) AddParam(key, value string) + func (c *Context) AsciiJSON(code int, obj any) + func (c *Context) Bind(obj any) error + func (c *Context) BindHeader(obj any) error + func (c *Context) BindJSON(obj any) error + func (c *Context) BindQuery(obj any) error + func (c *Context) BindTOML(obj any) error + func (c *Context) BindUri(obj any) error + func (c *Context) BindWith(obj any, b binding.Binding) error + func (c *Context) BindXML(obj any) error + func (c *Context) BindYAML(obj any) 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 any, 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) (values []string, ok 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) (values []string, ok 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]any) + 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 any) + 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 any) + func (c *Context) IsAborted() bool + func (c *Context) IsWebsocket() bool + func (c *Context) JSON(code int, obj any) + func (c *Context) JSONP(code int, obj any) + func (c *Context) MultipartForm() (*multipart.Form, error) + func (c *Context) MustBindWith(obj any, b binding.Binding) error + func (c *Context) MustGet(key string) any + 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) (value string) + func (c *Context) PostFormArray(key string) (values []string) + func (c *Context) PostFormMap(key string) (dicts map[string]string) + func (c *Context) ProtoBuf(code int, obj any) + func (c *Context) PureJSON(code int, obj any) + func (c *Context) Query(key string) (value string) + func (c *Context) QueryArray(key string) (values []string) + func (c *Context) QueryInt64(key string) (int64, error) + func (c *Context) QueryMap(key string) (dicts map[string]string) + func (c *Context) Redirect(code int, location string) + func (c *Context) RemoteIP() string + func (c *Context) Render(code int, r render.Render) + func (c *Context) SSEvent(name string, message any) + func (c *Context) SaveUploadedFile(file *multipart.FileHeader, dst string) error + func (c *Context) SecureJSON(code int, obj any) + func (c *Context) Set(key string, value any) + 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 any) error + func (c *Context) ShouldBindBodyWith(obj any, bb binding.BindingBody) (err error) + func (c *Context) ShouldBindHeader(obj any) error + func (c *Context) ShouldBindJSON(obj any) error + func (c *Context) ShouldBindQuery(obj any) error + func (c *Context) ShouldBindTOML(obj any) error + func (c *Context) ShouldBindUri(obj any) error + func (c *Context) ShouldBindWith(obj any, b binding.Binding) error + func (c *Context) ShouldBindXML(obj any) error + func (c *Context) ShouldBindYAML(obj any) 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 ...any) + func (c *Context) TOML(code int, obj any) + func (c *Context) Value(key any) any + func (c *Context) XML(code int, obj any) + func (c *Context) YAML(code int, obj any) + type Engine struct + AppEngine bool + ContextWithFallback bool + ForwardedByClientIP bool + FuncMap template.FuncMap + HTMLRender render.HTMLRender + HandleMethodNotAllowed bool + MaxMultipartMemory int64 + RedirectFixedPath bool + RedirectTrailingSlash bool + RemoteIPHeaders []string + RemoveExtraSlash bool + TrustedPlatform string + UnescapePathValues bool + UseH2C bool + UseRawPath bool + func Default(log logger.ILogger) *Engine + func New(log logger.ILogger) *Engine + func (engine *Engine) Delims(left, right string) *Engine + func (engine *Engine) HandleContext(c *Context) + func (engine *Engine) Handler() http.Handler + 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) SetFuncMap(funcMap template.FuncMap) + func (engine *Engine) SetHTMLTemplate(templ *template.Template) + func (engine *Engine) SetTrustedProxies(trustedProxies []string) error + func (engine *Engine) Use(middleware ...HandlerFunc) IRoutes + type Error struct + Err error + Meta any + Type ErrorType + func (msg *Error) IsType(flags ErrorType) bool + func (msg *Error) JSON() any + func (msg *Error) MarshalJSON() ([]byte, error) + func (msg *Error) SetMeta(data any) *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 GinLogger interface + Println func(format string, values ...any) + type H map[string]any + 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 any) 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 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 + Match 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 + StaticFileFS func(string, string, http.FileSystem) IRoutes + Use func(...HandlerFunc) IRoutes + type LogFormatter func(params LogFormatterParams) string + type LogFormatterParams struct + BodySize int + ClientIP string + ErrorMessage string + Keys map[string]any + 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 any + HTMLData any + HTMLName string + JSONData any + Offered []string + TOMLData any + XMLData any + YAMLData any + 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 any) + 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) Match(methods []string, 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) StaticFileFS(relativePath, filepath string, fs http.FileSystem) IRoutes + func (group *RouterGroup) Use(middleware ...HandlerFunc) IRoutes + type RoutesInfo []RouteInfo