handler

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DELETE

func DELETE[Req any, Resp any](r framework.Router, path string, handler framework.Handler[Req, Resp], optFn func(EndpointOptions))

DELETE registers a DELETE endpoint with type-safe handler using a fluent API Works with both Framework and Group through the Router interface Can be used directly: DELETE(f, path, handler).Summary("...").Tags("...").Register() Or without metadata: DELETE(f, path, handler).Register()

func GET

func GET[Req any, Resp any](r framework.Router, path string, handler framework.Handler[Req, Resp], optFn func(EndpointOptions))

GET registers a GET endpoint with type-safe handler using a fluent API Works with both Framework and Group through the Router interface Can be used directly: GET(f, path, handler).Summary("...").Tags("...").Register() Or without metadata: GET(f, path, handler).Register()

func PATCH

func PATCH[Req any, Resp any](r framework.Router, path string, handler framework.Handler[Req, Resp], optFn func(EndpointOptions))

PATCH registers a PATCH endpoint with type-safe handler using a fluent API Works with both Framework and Group through the Router interface Can be used directly: PATCH(f, path, handler).Summary("...").Tags("...").Register() Or without metadata: PATCH(f, path, handler).Register()

func POST

func POST[Req any, Resp any](r framework.Router, path string, handler framework.Handler[Req, Resp], optFn func(EndpointOptions))

POST registers a POST endpoint with type-safe handler using a fluent API Works with both Framework and Group through the Router interface Can be used directly: POST(f, path, handler).Summary("...").Tags("...").Register() Or without metadata: POST(f, path, handler).Register()

func PUT

func PUT[Req any, Resp any](r framework.Router, path string, handler framework.Handler[Req, Resp], optFn func(EndpointOptions))

PUT registers a PUT endpoint with type-safe handler using a fluent API Works with both Framework and Group through the Router interface Can be used directly: PUT(f, path, handler).Summary("...").Tags("...").Register() Or without metadata: PUT(f, path, handler).Register()

Types

type EndpointBuilder

type EndpointBuilder[Req any, Resp any] struct {
	*framework.HandlerRoute[Req, Resp]
}

EndpointBuilder provides a fluent API for building endpoints with optional metadata

func (*EndpointBuilder[Req, Resp]) SetDescription

func (b *EndpointBuilder[Req, Resp]) SetDescription(description string)

Description sets the endpoint description

func (*EndpointBuilder[Req, Resp]) SetSummary

func (b *EndpointBuilder[Req, Resp]) SetSummary(summary string)

Summary sets the endpoint summary

func (*EndpointBuilder[Req, Resp]) SetTags

func (b *EndpointBuilder[Req, Resp]) SetTags(tags ...string)

Tags sets the endpoint tags

func (*EndpointBuilder[Req, Resp]) Use

func (b *EndpointBuilder[Req, Resp]) Use(middleware ...framework.Middleware)

Use adds one or more middleware functions to the endpoint Middleware is applied in the order it's added (first added = outermost wrapper) Example: Use(logging, auth, ratelimit) wraps as logging(auth(ratelimit(handler)))

type EndpointOptions

type EndpointOptions interface {
	SetSummary(summary string)
	SetDescription(description string)
	SetTags(tags ...string)
}

Jump to

Keyboard shortcuts

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