hertzx

package
v1.2.24 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const ReleaseMode = "release"

Variables

This section is empty.

Functions

func HertzRequest

func HertzRequest(c *Context) *protocol.Request

func MethodPost

func MethodPost(c *Context) bool

func RequestContext

func RequestContext(c *Context) *app.RequestContext

func SetMode

func SetMode(string)

func SyncRequestBody

func SyncRequestBody(c *Context)

func SyncRequestURI

func SyncRequestURI(c *Context)

func Wrap

func Wrap(handler HandlerFunc) app.HandlerFunc

Types

type Context

type Context struct {
	Request *http.Request
	Writer  ResponseWriter
	Errors  ErrorChain
	// contains filtered or unexported fields
}

func ContextFromRequestContext

func ContextFromRequestContext(ctx *app.RequestContext) (*Context, bool)

func NewContext

func NewContext(base context.Context, ctx *app.RequestContext) *Context

func (*Context) Abort

func (c *Context) Abort()

func (*Context) AbortWithStatus

func (c *Context) AbortWithStatus(code int)

func (*Context) BindJSON

func (c *Context) BindJSON(obj interface{}) error

func (*Context) ClientIP

func (c *Context) ClientIP() string

func (*Context) Deadline

func (c *Context) Deadline() (time.Time, bool)

func (*Context) Done

func (c *Context) Done() <-chan struct{}

func (*Context) Err

func (c *Context) Err() error

func (*Context) Error

func (c *Context) Error(err error) *Error

func (*Context) FullPath

func (c *Context) FullPath() string

func (*Context) Get

func (c *Context) Get(key string) (interface{}, bool)

func (*Context) GetHeader

func (c *Context) GetHeader(key string) string

func (*Context) GetQuery

func (c *Context) GetQuery(key string) (string, bool)

func (*Context) GetString

func (c *Context) GetString(key string) string

func (*Context) HTML

func (c *Context) HTML(code int, name string, obj interface{})

func (*Context) Header

func (c *Context) Header(key, value string)

func (*Context) JSON

func (c *Context) JSON(code int, obj interface{})

func (*Context) Next

func (c *Context) Next()

func (*Context) Param

func (c *Context) Param(key string) string

func (*Context) Query

func (c *Context) Query(key string) string

func (*Context) Redirect

func (c *Context) Redirect(code int, location string)

func (*Context) Set

func (c *Context) Set(key string, value interface{})

func (*Context) ShouldBind

func (c *Context) ShouldBind(obj interface{}) error

func (*Context) ShouldBindJSON

func (c *Context) ShouldBindJSON(obj interface{}) error

func (*Context) ShouldBindQuery

func (c *Context) ShouldBindQuery(obj interface{}) error

func (*Context) ShouldBindUri

func (c *Context) ShouldBindUri(obj interface{}) error

func (*Context) Status

func (c *Context) Status(code int)

func (*Context) String

func (c *Context) String(code int, format string, values ...interface{})

func (*Context) Value

func (c *Context) Value(key interface{}) interface{}

type Engine

type Engine struct {
	RemoteIPHeaders []string
	// contains filtered or unexported fields
}

func Default

func Default(opts ...config.Option) *Engine

func New

func New(opts ...config.Option) *Engine

func (*Engine) Any

func (e *Engine) Any(path string, handlers ...HandlerFunc)

func (*Engine) DELETE

func (e *Engine) DELETE(path string, handlers ...HandlerFunc)

func (*Engine) GET

func (e *Engine) GET(path string, handlers ...HandlerFunc)

func (*Engine) Group

func (e *Engine) Group(relativePath string, handlers ...HandlerFunc) *RouterGroup

func (*Engine) Hertz

func (e *Engine) Hertz() *server.Hertz

func (*Engine) LoadHTMLFiles

func (e *Engine) LoadHTMLFiles(files ...string)

func (*Engine) LoadHTMLGlob

func (e *Engine) LoadHTMLGlob(pattern string)

func (*Engine) NoRoute

func (e *Engine) NoRoute(handlers ...HandlerFunc)

func (*Engine) POST

func (e *Engine) POST(path string, handlers ...HandlerFunc)

func (*Engine) PUT

func (e *Engine) PUT(path string, handlers ...HandlerFunc)

func (*Engine) Run

func (e *Engine) Run(addr ...string) error

func (*Engine) RunTLS

func (e *Engine) RunTLS(addr, certFile, keyFile string) error

func (*Engine) ServeHTTP

func (e *Engine) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Engine) SetHTMLTemplate

func (e *Engine) SetHTMLTemplate(tmpl *template.Template)

func (*Engine) Use

func (e *Engine) Use(handlers ...HandlerFunc)

type Error

type Error struct {
	Err error
}

func (*Error) Error

func (e *Error) Error() string

type ErrorChain

type ErrorChain []*Error

func (ErrorChain) Last

func (e ErrorChain) Last() *Error

func (ErrorChain) String

func (e ErrorChain) String() string

type H

type H map[string]interface{}

type HandlerFunc

type HandlerFunc func(*Context)

func Recovery

func Recovery() HandlerFunc

type ResponseWriter

type ResponseWriter interface {
	http.ResponseWriter
	http.Hijacker
	http.Flusher
	http.CloseNotifier

	Status() int
	Size() int
	Written() bool
	WriteHeaderNow()
	WriteString(string) (int, error)
	Pusher() http.Pusher
	SyncFromHertz(*app.RequestContext)
}

type RouterGroup

type RouterGroup struct {
	// contains filtered or unexported fields
}

func (*RouterGroup) Any

func (g *RouterGroup) Any(path string, handlers ...HandlerFunc)

func (*RouterGroup) DELETE

func (g *RouterGroup) DELETE(path string, handlers ...HandlerFunc)

func (*RouterGroup) GET

func (g *RouterGroup) GET(path string, handlers ...HandlerFunc)

func (*RouterGroup) Group

func (g *RouterGroup) Group(relativePath string, handlers ...HandlerFunc) *RouterGroup

func (*RouterGroup) POST

func (g *RouterGroup) POST(path string, handlers ...HandlerFunc)

func (*RouterGroup) PUT

func (g *RouterGroup) PUT(path string, handlers ...HandlerFunc)

func (*RouterGroup) Use

func (g *RouterGroup) Use(handlers ...HandlerFunc)

Jump to

Keyboard shortcuts

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