web

package
v0.0.0-...-9ed9871 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(r *http.Request, val interface{}) error

func GetTraceID

func GetTraceID(ctx context.Context) string

func IsShutdown

func IsShutdown(err error) bool

func NewShutdownError

func NewShutdownError(message string) error

func Param

func Param(r *http.Request, key string) string

func Respond

func Respond(ctx context.Context, w http.ResponseWriter, data interface{}, statusCode int) error

func SetStatusCode

func SetStatusCode(ctx context.Context, statusCode int) error

Types

type App

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

func NewApp

func NewApp(shutdown chan os.Signal, mw ...Middleware) *App

func (*App) Handle

func (a *App) Handle(method string, group string, path string, handler Handler, mw ...Middleware)

func (*App) ServeHTTP

func (a *App) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*App) SignalShutdown

func (a *App) SignalShutdown()

type Handler

type Handler func(ctx context.Context, w http.ResponseWriter, r *http.Request) error

type Middleware

type Middleware func(Handler) Handler

type Values

type Values struct {
	TraceID    string
	Now        time.Time
	StatusCode int
}

func GetValues

func GetValues(ctx context.Context) (*Values, error)

Jump to

Keyboard shortcuts

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