echobind

package module
v0.0.0-...-0f945a7 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindJSON

func BindJSON[P any](c *echo.Context) (*P, error)

BindJSON parses the request body into a *P using Echo's Bind

func Identity

func Identity[I any](in *I) (*I, error)

Identity is a passthrough transformer

func IndirectJSONInput

func IndirectJSONInput[P any, I any](t func(*P) (*I, error)) func(c *echo.Context) (*I, error)

IndirectJSONInput parses the request body into a *P before passing it to a user-defined transformer function that produces a *I.

func Transform

func Transform[I any, O any](getInput func(c *echo.Context) (*I, error), t func(*I) (*O, error)) func(c *echo.Context) (*O, error)

Transform returns a function that reads input from an Echo context as an *I before passing it to a user-defined transformer function that produces an *O.

func WriteJSON

func WriteJSON[T any](c *echo.Context, val *T) error

WriteJSON writes a *T to the response as JSON with status 200

func Zero

func Zero[I any](c *echo.Context) (*I, error)

Zero returns a zero-value input

Types

type Invoker

type Invoker[Tx operator.Transaction, I any, O any] struct {
	// contains filtered or unexported fields
}

Invoker acts as a configuration point when binding operations to Echo handlers. Use its With* functions to customise input and output behaviour, then call Go() to invoke the operation.

func Bind

func Bind[Tx operator.Transaction, I any, O any](
	hub *operator.Hub[Tx],
	op func(*operator.OpContext[Tx], *I) (*O, error),
) *Invoker[Tx, I, O]

Bind creates an Invoker binding the operation to an Echo handler. The returned Invoker can be further customised before finally calling Go().

func BindTx

func BindTx[Tx operator.Transaction, I any, O any](
	hub *operator.Hub[Tx],
	op func(*operator.OpContext[Tx], Tx, *I) (*O, error),
) *Invoker[Tx, I, O]

BindTx creates an Invoker binding the transactional operation to an Echo handler. The returned Invoker can be further customised before finally calling Go().

func (*Invoker[Tx, I, O]) Go

func (i *Invoker[Tx, I, O]) Go(c *echo.Context) error

Go invokes the bound operation in the context of the supplied Echo request. Its signature matches echo.HandlerFunc.

func (*Invoker[Tx, I, O]) WithContext

func (i *Invoker[Tx, I, O]) WithContext(ctx context.Context) *Invoker[Tx, I, O]

WithContext sets a static context for the operation

func (*Invoker[Tx, I, O]) WithContextFunc

func (i *Invoker[Tx, I, O]) WithContextFunc(fn func(*echo.Context) context.Context) *Invoker[Tx, I, O]

WithContextFunc sets fn as a context factory for the operation.

func (*Invoker[Tx, I, O]) WithInputMapper

func (i *Invoker[Tx, I, O]) WithInputMapper(fn func(*echo.Context) (*I, error)) *Invoker[Tx, I, O]

WithInputMapper registers the binding's input mapper

func (*Invoker[Tx, I, O]) WithJSONOutput

func (i *Invoker[Tx, I, O]) WithJSONOutput(fn func(c *echo.Context, o *O) any) *Invoker[Tx, I, O]

WithJSONOutput sets an output mapper that writes the result of fn as JSON

func (*Invoker[Tx, I, O]) WithJSONOutputFunc

func (i *Invoker[Tx, I, O]) WithJSONOutputFunc(fn func(c *echo.Context, o *O) error) *Invoker[Tx, I, O]

WithJSONOutputFunc sets an output mapper that calls fn after setting the JSON content type

func (*Invoker[Tx, I, O]) WithOutputMapper

func (i *Invoker[Tx, I, O]) WithOutputMapper(fn func(c *echo.Context, o *O) error) *Invoker[Tx, I, O]

WithOutputMapper registers the binding's output mapper

Jump to

Keyboard shortcuts

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