Documentation
¶
Index ¶
- Constants
- func BindDeepObjectParam(paramName string, queryParams url.Values, dest any) error
- func BindFormExplodeParam(paramName string, required bool, queryParams url.Values, dest any) error
- func BindFormParam(paramName string, paramLocation ParamLocation, value string, dest any) error
- func BindLabelExplodeParam(paramName string, paramLocation ParamLocation, value string, dest any) error
- func BindLabelParam(paramName string, paramLocation ParamLocation, value string, dest any) error
- func BindSimpleExplodeParam(paramName string, paramLocation ParamLocation, value string, dest any) error
- func BindSimpleParam(paramName string, paramLocation ParamLocation, value string, dest any) error
- func BindStringToObject(src string, dst any) error
- func MarshalDeepObject(i any, paramName string) (string, error)
- func MarshalForm(body interface{}) (url.Values, error)
- func StyleDeepObjectParam(paramName string, paramLocation ParamLocation, value any) (string, error)
- func StyleFormExplodeParam(paramName string, paramLocation ParamLocation, value any) (string, error)
- func StyleFormParam(paramName string, paramLocation ParamLocation, value any) (string, error)
- func StyleLabelExplodeParam(paramName string, paramLocation ParamLocation, value any) (string, error)
- func StyleLabelParam(paramName string, paramLocation ParamLocation, value any) (string, error)
- func StyleSimpleExplodeParam(paramName string, paramLocation ParamLocation, value any) (string, error)
- func StyleSimpleParam(paramName string, paramLocation ParamLocation, value any) (string, error)
- func UnmarshalDeepObject(dst any, paramName string, params url.Values) error
- type Binder
- type Date
- type ParamLocation
Constants ¶
const DateFormat = "2006-01-02"
Variables ¶
This section is empty.
Functions ¶
func BindDeepObjectParam ¶
BindDeepObjectParam binds a deepObject-style parameter to a destination. DeepObject style is only valid for query parameters and must be exploded. Objects: ?paramName[key1]=value1¶mName[key2]=value2 -> struct{Key1, Key2} Nested: ?paramName[outer][inner]=value -> struct{Outer: {Inner: value}}
func BindFormExplodeParam ¶
BindFormExplodeParam binds a form-style parameter with explode to a destination. Form style is the default for query and cookie parameters. This handles the exploded case where arrays come as multiple query params. Arrays: ?param=a¶m=b -> []string{"a", "b"} (values passed as slice) Objects: ?key1=value1&key2=value2 -> struct{Key1, Key2} (queryParams passed)
func BindFormParam ¶
func BindFormParam(paramName string, paramLocation ParamLocation, value string, dest any) error
BindFormParam binds a form-style parameter without explode to a destination. Form style is the default for query and cookie parameters. This function handles a single query parameter value (not url.Values). Arrays: a,b,c -> []string{"a", "b", "c"} Objects: key1,value1,key2,value2 -> struct{Key1, Key2}
func BindLabelExplodeParam ¶
func BindLabelExplodeParam(paramName string, paramLocation ParamLocation, value string, dest any) error
BindLabelExplodeParam binds a label-style parameter with explode to a destination. Label style values are prefixed with a dot. Primitives: .value -> "value" Arrays: .a.b.c -> []string{"a", "b", "c"} Objects: .key1=value1.key2=value2 -> struct{Key1, Key2}
func BindLabelParam ¶
func BindLabelParam(paramName string, paramLocation ParamLocation, value string, dest any) error
BindLabelParam binds a label-style parameter without explode to a destination. Label style values are prefixed with a dot. Primitives: .value -> "value" Arrays: .a,b,c -> []string{"a", "b", "c"} Objects: .key1,value1,key2,value2 -> struct{Key1, Key2}
func BindSimpleExplodeParam ¶
func BindSimpleExplodeParam(paramName string, paramLocation ParamLocation, value string, dest any) error
BindSimpleExplodeParam binds a simple-style parameter with explode to a destination. Simple style is the default for path and header parameters. Arrays: a,b,c -> []string{"a", "b", "c"} (same as non-explode) Objects: key1=value1,key2=value2 -> struct{Key1, Key2}
func BindSimpleParam ¶
func BindSimpleParam(paramName string, paramLocation ParamLocation, value string, dest any) error
BindSimpleParam binds a simple-style parameter without explode to a destination. Simple style is the default for path and header parameters. Arrays: a,b,c -> []string{"a", "b", "c"} Objects: key1,value1,key2,value2 -> struct{Key1, Key2}
func BindStringToObject ¶
BindStringToObject binds a string value to a destination object. It handles primitives, encoding.TextUnmarshaler, and the Binder interface.
func MarshalDeepObject ¶
MarshalDeepObject marshals an object to deepObject style query parameters.
func MarshalForm ¶
MarshalForm marshals a struct into url.Values using the struct's json tags as field names. It handles nested structs, slices, pointers, and AdditionalProperties maps.
func StyleDeepObjectParam ¶
func StyleDeepObjectParam(paramName string, paramLocation ParamLocation, value any) (string, error)
StyleDeepObjectParam serializes a value using deepObject style. DeepObject style is only valid for query parameters with object values and must be exploded. Objects: paramName[key1]=value1¶mName[key2]=value2 Nested: paramName[outer][inner]=value
func StyleFormExplodeParam ¶
func StyleFormExplodeParam(paramName string, paramLocation ParamLocation, value any) (string, error)
StyleFormExplodeParam serializes a value using form style (RFC 6570) with exploding. Form style is the default for query and cookie parameters. Primitives: paramName=value Arrays: paramName=a¶mName=b¶mName=c Objects: key1=value1&key2=value2
func StyleFormParam ¶
func StyleFormParam(paramName string, paramLocation ParamLocation, value any) (string, error)
StyleFormParam serializes a value using form style (RFC 6570) without exploding. Form style is the default for query and cookie parameters. Primitives: paramName=value Arrays: paramName=a,b,c Objects: paramName=key1,value1,key2,value2
func StyleLabelExplodeParam ¶
func StyleLabelExplodeParam(paramName string, paramLocation ParamLocation, value any) (string, error)
StyleLabelExplodeParam serializes a value using label style (RFC 6570) with exploding. Label style prefixes values with a dot. Primitives: .value Arrays: .a.b.c Objects: .key1=value1.key2=value2
func StyleLabelParam ¶
func StyleLabelParam(paramName string, paramLocation ParamLocation, value any) (string, error)
StyleLabelParam serializes a value using label style (RFC 6570) without exploding. Label style prefixes values with a dot. Primitives: .value Arrays: .a,b,c Objects: .key1,value1,key2,value2
func StyleSimpleExplodeParam ¶
func StyleSimpleExplodeParam(paramName string, paramLocation ParamLocation, value any) (string, error)
StyleSimpleExplodeParam serializes a value using simple style (RFC 6570) with exploding. Simple style is the default for path and header parameters. Arrays are comma-separated: a,b,c (same as non-explode) Objects are key=value pairs: key1=value1,key2=value2
func StyleSimpleParam ¶
func StyleSimpleParam(paramName string, paramLocation ParamLocation, value any) (string, error)
StyleSimpleParam serializes a value using simple style (RFC 6570) without exploding. Simple style is the default for path and header parameters. Arrays are comma-separated: a,b,c Objects are key,value pairs: key1,value1,key2,value2
Types ¶
type Date ¶
func (Date) MarshalJSON ¶
func (Date) MarshalText ¶
MarshalText implements encoding.TextMarshaler for Date.
func (*Date) UnmarshalJSON ¶
func (*Date) UnmarshalText ¶
type ParamLocation ¶
type ParamLocation int
ParamLocation indicates where a parameter is located in an HTTP request.
const ( ParamLocationUndefined ParamLocation = iota ParamLocationQuery ParamLocationPath ParamLocationHeader ParamLocationCookie )
Source Files
¶
- bind_deepObject.gen.go
- bind_form.gen.go
- bind_form_explode.gen.go
- bind_label.gen.go
- bind_label_explode.gen.go
- bind_simple.gen.go
- bind_simple_explode.gen.go
- date.gen.go
- generate.go
- helpers.gen.go
- marshal_form.gen.go
- style_deepObject.gen.go
- style_form.gen.go
- style_form_explode.gen.go
- style_label.gen.go
- style_label_explode.gen.go
- style_simple.gen.go
- style_simple_explode.gen.go
Directories
¶
| Path | Synopsis |
|---|---|
|
genhelpers generates Go files from helper and param templates.
|
genhelpers generates Go files from helper and param templates. |