web

package
v0.1.102 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context interface {
	// Request returns `*http.Request`.
	Request() *http.Request

	// Get retrieves data from the context.
	Get(key any) any

	// Set saves data in the context.
	Set(key any, val any)

	// Response returns `http.ResponseWriter`.
	Response() http.ResponseWriter

	// NoContent sends a response with no body and a status code.
	NoContent(code int) error

	// String sends a string response with status code.
	String(code int, s string) error

	// JSON sends a JSON response with status code.
	JSON(code int, data any) error

	// Bind binds path params, query params and the request body into provided type `i`. The default binder
	// binds body based on Content-Type header.
	Bind(i any) error

	// Error sends an error back to the client.
	Error(code int, err error)

	// Done returns a channel that's closed when work done on behalf of this
	// context should be canceled.
	Done() <-chan any
}

type HandlerFunc

type HandlerFunc func(c Context) error

type MiddlewareFunc

type MiddlewareFunc func(next HandlerFunc) HandlerFunc

Jump to

Keyboard shortcuts

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