Documentation
¶
Index ¶
- func FromBinary(data any, target any) error
- func FromFormData(formData []byte, dest interface{}) error
- func FromFormUrlEncoded(data []byte, target any) error
- func FromJSON(data []byte, target any) error
- func FromText[T any](data []byte, target any) error
- func FromXML(data []byte, target any) error
- func ToBinary(data any) (*bytes.Reader, error)
- func ToFormData(data interface{}) (*bytes.Reader, string, error)
- func ToFormUrlEncoded(data any) (*bytes.Reader, error)
- func ToJSON(data any) (*bytes.Reader, error)
- func ToText(data any) (*bytes.Reader, error)
- func ToXML(data any) (*bytes.Reader, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromBinary ¶
FromBinary deserializes binary response data into a byte slice target. The target must be a non-nil pointer to []byte. Returns an error if conversion fails.
func FromFormData ¶
FromFormData deserializes multipart/form-data into a struct. Uses 'form' tags to map form fields to struct fields. Supports string, int, float, and bool types.
func FromFormUrlEncoded ¶
FromFormUrlEncoded deserializes URL-encoded form data into a struct. Uses struct field json tags to map form keys to struct fields. Only string fields are supported.
func FromJSON ¶
FromJSON deserializes JSON data from HTTP response bodies into the target struct. Uses the custom unmarshal package to handle complex types and validations.
func FromText ¶
FromText deserializes plain text response data into a string target. The target must be a non-nil pointer to a string. Returns an error for unsupported types.
func FromXML ¶
FromXML deserializes XML data from HTTP response bodies into the target struct. Uses the standard encoding/xml package for unmarshaling.
func ToBinary ¶
ToBinary serializes byte slice data for binary request bodies. Returns an error if the data is not a []byte.
func ToFormData ¶
ToFormData converts structs and primitives to multipart/form-data format for request bodies. Returns the encoded data, Content-Type header with boundary, and any error. Supports nested structs and byte arrays.
func ToFormUrlEncoded ¶
ToFormUrlEncoded serializes a struct to URL-encoded form format for request bodies. Uses struct field json tags as form keys. Supports string, int, float, and bool types.
func ToJSON ¶
ToJSON serializes data to JSON format for HTTP request bodies. Returns a bytes.Reader containing the JSON-encoded data, or nil if data is nil.
Types ¶
This section is empty.