Documentation
¶
Index ¶
- func ExtractExtraProperties(bytes []byte, value interface{}, exclude ...string) (map[string]interface{}, error)
- func MarshalJSONWithExtraProperties(marshaler interface{}, extraProperties map[string]interface{}) ([]byte, error)
- func MarshalJSONWithExtraProperty(marshaler interface{}, key string, value interface{}) ([]byte, error)
- func StringifyJSON(value interface{}) (string, error)
- type Date
- type DateTime
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractExtraProperties ¶
func ExtractExtraProperties(bytes []byte, value interface{}, exclude ...string) (map[string]interface{}, error)
ExtractExtraProperties extracts any extra properties from the given value.
func MarshalJSONWithExtraProperties ¶
func MarshalJSONWithExtraProperties(marshaler interface{}, extraProperties map[string]interface{}) ([]byte, error)
MarshalJSONWithExtraProperties marshals the given value to JSON, including any extra properties.
func MarshalJSONWithExtraProperty ¶
func MarshalJSONWithExtraProperty(marshaler interface{}, key string, value interface{}) ([]byte, error)
MarshalJSONWithExtraProperty marshals the given value to JSON, including the extra property.
func StringifyJSON ¶
StringifyJSON returns a pretty JSON string representation of the given value.
Types ¶
type Date ¶
type Date struct {
// contains filtered or unexported fields
}
DateTime wraps time.Time and adapts its JSON representation to conform to a RFC3339 date (e.g. 2006-01-02).
Ref: https://ijmacd.github.io/rfc3339-iso8601
func NewOptionalDate ¶
NewOptionalDate returns a new *Date. If the given time.Time is nil, nil will be returned.
func (*Date) MarshalJSON ¶
func (*Date) Time ¶
Time returns the Date's underlying time, if any. If the date is nil, the zero value is returned.
func (*Date) UnmarshalJSON ¶
type DateTime ¶
type DateTime struct {
// contains filtered or unexported fields
}
DateTime wraps time.Time and adapts its JSON representation to conform to a RFC3339 date-time (e.g. 2017-07-21T17:32:28Z).
Ref: https://ijmacd.github.io/rfc3339-iso8601
func NewOptionalDateTime ¶
NewOptionalDateTime returns a new *DateTime. If the given time.Time is nil, nil will be returned.
func (*DateTime) MarshalJSON ¶
func (*DateTime) Time ¶
Time returns the DateTime's underlying time, if any. If the date-time is nil, the zero value is returned.
func (*DateTime) TimePtr ¶
TimePtr returns a pointer to the DateTime's underlying time.Time, if any.