Documentation ¶
Overview ¶
Package web contains a small web framework extension.
Index ¶
- func Decode(r *http.Request, val any) error
- func GetTime(ctx context.Context) time.Time
- func GetTraceID(ctx context.Context) string
- func IsShutdown(err error) bool
- func NewShutdownError(message string) error
- func Param(r *http.Request, key string) string
- func SetValues(ctx context.Context, v *Values) context.Context
- type App
- type Logger
- type Values
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Decode reads the body of an HTTP request looking for a JSON document. The body is decoded into the provided value. If the provided value is a struct then it is checked for validation tags. If the value implements a validate function, it is executed.
func GetTraceID ¶
GetTraceID returns the trace id from the context.
func IsShutdown ¶
IsShutdown checks to see if the shutdown error is contained in the specified error value.
func NewShutdownError ¶
NewShutdownError returns an error that causes the framework to signal a graceful shutdown.
Types ¶
type App ¶
App is the entrypoint into our application and what configures our context object for each of our http handlers. Feel free to add any configuration data/logic on this App struct.