bind

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultMultipartFormMaxMemory = int64(32 << 20) // 32MB
	DefaultQuerySeparator         = ","
)

Functions

func Bind

func Bind(req *http.Request, obj any, opts ...Option) error

Bind binds HTTP request data to a struct based on content type and struct tags.

Types

type Option added in v0.1.13

type Option func(*option)

Option defines a function type for setting options.

func WithMultipartFormMaxMemory added in v0.1.13

func WithMultipartFormMaxMemory(maxMemory int64) Option

WithMultipartFormMaxMemory sets the maximum memory for parsing multipart forms

  • default is 32MB (32 << 20 bytes)

func WithQuerySeparator added in v0.1.13

func WithQuerySeparator(sep string) Option

WithQuerySeparator sets the separator for query parameters when binding slices

  • default is "," -> ?ids=1,2,3
  • set to "" to disable splitting

Jump to

Keyboard shortcuts

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