Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NumberOrString ¶
type NumberOrString string
NumberOrString is a string that when marshalled/unmarsalled to/from json will be represented as a number if strconv.Atoi believes it is a number, or a string otherwise.
func (NumberOrString) Int ¶
func (nos NumberOrString) Int() (int, error)
Int returns the NumberOrString as an Int, if possible.
func (NumberOrString) MarshalJSON ¶
func (nos NumberOrString) MarshalJSON() ([]byte, error)
MarshalJSON marshals the NumberOrString, representing is as a number where appropriate.
func (NumberOrString) String ¶
func (nos NumberOrString) String() string
String returns the NumberOrString as a string, irrespective of whether it can be represented as a number.
func (*NumberOrString) UnmarshalJSON ¶
func (nos *NumberOrString) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals a NumberOrString accepting either a json number or string.
Click to show internal directories.
Click to hide internal directories.