Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bool ¶
type Bool bool
Bool represents a bool that can be unmarshaled from various JSON types Null values are converted to false instead of preserving null state Accepts: booleans, strings ("1", "true", "success" → true), numbers (non-zero → true), and null (→ false)
func (Bool) MarshalJSON ¶
MarshalJSON implements json.Marshaler for Bool
func (*Bool) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler for Bool
type Float ¶
type Float float64
Float represents a float64 that can be unmarshaled from various JSON types Null values are converted to zero instead of preserving null state Accepts: floats, integers, string representations of numbers, and null (→ 0.0)
func (Float) MarshalJSON ¶
MarshalJSON implements json.Marshaler for Float
func (*Float) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler for Float
type Int ¶
type Int int64
Int represents an int64 that can be unmarshaled from various JSON types Null values are converted to zero instead of preserving null state Accepts: integers, floats (truncated), string representations of numbers, and null (→ 0)
func (Int) MarshalJSON ¶
MarshalJSON implements json.Marshaler for Int
func (*Int) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler for Int
type NullBool ¶
NullBool represents a bool that may be null in JSON Unlike MultiBool, this preserves null values instead of converting them to false Accepts: booleans, string representations ("true", "success", "1" as true), and null
func NewNullBool ¶
NewNullBool creates a new valid NullBool with the given value
func (NullBool) MarshalJSON ¶
MarshalJSON implements json.Marshaler for NullBool
func (NullBool) String ¶
String returns the string representation of the boolean, or "null" if not valid
func (*NullBool) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler for NullBool
type NullFloat ¶
NullFloat represents a float64 that may be null in JSON Accepts: floats, integers, string representations of numbers, and null
func NewNullFloat ¶
NewNullFloat creates a new valid NullFloat with the given value
func (NullFloat) MarshalJSON ¶
MarshalJSON implements json.Marshaler for NullFloat
func (NullFloat) String ¶
String returns the string representation of the float, or "null" if not valid
func (*NullFloat) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler for NullFloat
type NullInt ¶
NullInt represents an int64 that may be null in JSON Unlike MultiInt, this preserves null values instead of converting them to zero Accepts: integers, floats (truncated), string representations of numbers, and null
func NewNullInt ¶
NewNullInt creates a new valid NullInt with the given value
func (NullInt) MarshalJSON ¶
MarshalJSON implements json.Marshaler for NullInt
func (NullInt) String ¶
String returns the string representation of the integer, or "null" if not valid
func (*NullInt) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler for NullInt
type NullString ¶
NullString represents a string that may be null in JSON Unlike MultiString, this preserves null values instead of converting them to empty strings Accepts: strings, numbers (converted to strings), and null
func NewNullString ¶
func NewNullString(value string) NullString
NewNullString creates a new valid NullString with the given value
func (NullString) MarshalJSON ¶
func (ns NullString) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler for NullString
func (NullString) String ¶
func (ns NullString) String() string
String returns the string representation, or "null" if not valid
func (*NullString) UnmarshalJSON ¶
func (ns *NullString) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler for NullString
func (NullString) ValueOr ¶
func (ns NullString) ValueOr(fallback string) string
ValueOr returns the string value if valid, otherwise returns the fallback value
type NullTime ¶
NullTime represents a time.Time that may be null in JSON Unlike MultiDateTime, this preserves null values instead of converting them to zero time Accepts: RFC3339 strings, various datetime formats, and null
func NewNullTime ¶
NewNullTime creates a new valid NullTime with the given value
func NewNullTimeFromString ¶
NewNullTimeFromString creates a new NullTime by parsing the given string
func (NullTime) MarshalJSON ¶
MarshalJSON implements json.Marshaler for NullTime
func (NullTime) String ¶
String returns the string representation of the time, or "null" if not valid
func (*NullTime) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler for NullTime
type NullUint ¶
NullUint represents a uint64 that may be null in JSON Unlike Uint, this preserves null values instead of converting them to zero Accepts: unsigned integers, floats (truncated), string representations of numbers, and null
func NewNullUint ¶
NewNullUint creates a new valid NullUint with the given value
func (NullUint) MarshalJSON ¶
MarshalJSON implements json.Marshaler for NullUint
func (NullUint) String ¶
String returns the string representation of the uint, or "null" if not valid
func (*NullUint) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler for NullUint
type String ¶
type String string
String represents a string that can be unmarshaled from various JSON types Null values are converted to empty string instead of preserving null state Accepts: strings, numbers (converted to strings), and null (→ "")
func (String) MarshalJSON ¶
MarshalJSON implements json.Marshaler for String
func (*String) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler for String
type Time ¶
Time represents a time.Time that can be unmarshaled from various JSON types Null values are converted to zero time instead of preserving null state Accepts: RFC3339 strings, RFC3339Nano strings, and null (→ zero time)
func NewTimeFromString ¶
NewTimeFromString creates a new Time by parsing a string
func (Time) MarshalJSON ¶
MarshalJSON implements json.Marshaler for Time
func (*Time) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler for Time
type Uint ¶
type Uint uint64
Uint represents a uint64 that converts null JSON values to zero This is the non-null variant that treats null as 0 For preserving null values, use NullUint instead
func (Uint) MarshalJSON ¶
MarshalJSON implements json.Marshaler for Uint
func (*Uint) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler for Uint