Documentation ¶
Overview ¶
Package urlquery allows converting structs to/from URL query parameters.
Index ¶
Constants ¶
View Source
const ( ArrayImplicit = iota ArrayExplicit ArrayIndexed ArrayCSV ArrayNone )
The following options control array expression when encoding.
View Source
const ( KeysIndexed = iota KeysDotted KeysNone )
The following options control sub-key expression when encoding.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Emptier ¶
type Emptier interface {
IsEmpty() bool
}
Emptier may be used in conjunction with the omitempty struct tag. Any type that implements this interface may return false here to be omitted in output when the tag is present.
type Encoding ¶
type Encoding struct { // FormatBool specifies a custom Bool formatting. Defaults to calling // strconv.FormatBool, which returns the strings "true" and "false". FormatBool func(bool) string // ArrayMode indicates how to encode arrays. The options are: // // - ArrayImplicit -- No special treatment (default) // - ArrayExplicit -- Adds a [] suffix to the key name // - ArrayIndexed -- Each array element is indexed by adding a [n] suffix to the key name // - ArrayCSV -- All values are added to a single key, as a list of CSV values // - ArrayNone -- An array will return an error ArrayMode int // KeyMode indicates how to encode object keys. The options are: // // - KeysIndexed -- Keys are wrapped in square brackets // - KeysDotted -- Keys are separated by periods // - KeysNone -- Any sub-keys will return an error. KeyMode int // Tag specifies the name of the struct tag to look for. Defaults to url. // Set Tag to "-" to disable struct tag parsing. Tag string }
Encoding represents a specific set of encoding/decoding rules for URL query mapping.
type Primitive ¶
type Primitive interface{}
Primitive is one of the following underlying types:
- string
- []Primitive
- map[string]Primitive
type URLMarshaler ¶
URLMarshaler may be implemented by any type to support conversion to query parameters.
Click to show internal directories.
Click to hide internal directories.