binding

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 3 Imported by: 0

README

internal/delivery/http/binding

Pattern used

  • NormalizeBinder wraps any echo.Binder: delegates bind, then trims and optionally case-converts string fields via struct tags (trim:"false", case:"lower", case:"upper").
  • Handles nested structs, pointers, and slices.
  • Injected into NewServer via constructor; pass nil for the default normalize binder.

How to extend

  • New normalization: add a struct tag, read it in normalizeStruct, apply in a helper. Add tests.
  • Custom binder: implement echo.Binder, pass it to NewServer in wiring.
  • Opt-out per field: trim:"false".

Documentation

Overview

Package binding provides Echo binding helpers. The NormalizeBinder wraps any Binder and normalizes string fields after binding: trim leading/trailing whitespace, and optional case via tags. Use trim:"false" to opt out of trim. Use case:"lower" or case:"upper" to normalize case after trim; omit to leave case unchanged.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNormalizeBinder

func NewNormalizeBinder(inner echo.Binder) echo.Binder

NewNormalizeBinder returns a Binder that delegates to inner then normalizes string fields (trim and optional case). If inner is nil, echo.DefaultBinder is used.

Types

This section is empty.

Jump to

Keyboard shortcuts

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