Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Decode [str] to bytes using the given encoding If [str] is the empty string, returns a nil byte slice and nil error
Types ¶
type Encoding ¶
type Encoding uint8
Encoding defines how bytes are converted to a string and vice versa
func (Encoding) MarshalJSON ¶
func (Encoding) MarshalText ¶ added in v1.1.3
MarshalText and UnmarshalText are the encoding's written form, which is the one it has always had: MarshalJSON writes this same word in quotes. It is said here as well because a URL carries text and no JSON. A read served as a GET asks for its encoding with ?encoding=json, and an encoding read as the number its kind is left every such request on Hex, which is what zero is.
func (*Encoding) UnmarshalJSON ¶
UnmarshalJSON reads the same word, quoted. The mapping is in UnmarshalText and is not written a second time; null is JSON's spelling of an absent field, which leaves the encoding as it was.