web

package
v0.0.0-...-cadae65 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: CC0-1.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildStdHttpFunc

func BuildStdHttpFunc(mids Middlewares, handlerFunc HandlerFunc) http.HandlerFunc

BuildStdHttpFunc はいい感じにラップした標準パッケージの http.HandlerFunc を組み立てます。

func GetStatusCode

func GetStatusCode(ctx context.Context) int

func Respond

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

Respond は HTTP レスポンスを返します。

Types

type HandlerFunc

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

func Recover

func Recover(next HandlerFunc) HandlerFunc

Recover はパニックを回復し、アプリケーション全体がクラッシュするのを防ぎます。

type Middleware

type Middleware func(next HandlerFunc) HandlerFunc

type Middlewares

type Middlewares []Middleware

func (Middlewares) Append

func (mids Middlewares) Append(args ...Middleware) Middlewares

type RequestScopeValues

type RequestScopeValues struct {
	StartTime time.Time
	// contains filtered or unexported fields
}

func GetValues

func GetValues(ctx context.Context) RequestScopeValues

func NewRequestScopeValues

func NewRequestScopeValues() RequestScopeValues

Jump to

Keyboard shortcuts

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