core

package
v0.0.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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

func StringifyJSON(value interface{}) (string, error)

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 NewDate

func NewDate(t time.Time) *Date

NewDate returns a new *Date. If the given time.Time is nil, nil will be returned.

func NewOptionalDate

func NewOptionalDate(t *time.Time) *Date

NewOptionalDate returns a new *Date. If the given time.Time is nil, nil will be returned.

func (*Date) MarshalJSON

func (d *Date) MarshalJSON() ([]byte, error)

func (*Date) Time

func (d *Date) Time() time.Time

Time returns the Date's underlying time, if any. If the date is nil, the zero value is returned.

func (*Date) TimePtr

func (d *Date) TimePtr() *time.Time

TimePtr returns a pointer to the Date's underlying time.Time, if any.

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(data []byte) error

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 NewDateTime

func NewDateTime(t time.Time) *DateTime

NewDateTime returns a new *DateTime.

func NewOptionalDateTime

func NewOptionalDateTime(t *time.Time) *DateTime

NewOptionalDateTime returns a new *DateTime. If the given time.Time is nil, nil will be returned.

func (*DateTime) MarshalJSON

func (d *DateTime) MarshalJSON() ([]byte, error)

func (*DateTime) Time

func (d *DateTime) Time() time.Time

Time returns the DateTime's underlying time, if any. If the date-time is nil, the zero value is returned.

func (*DateTime) TimePtr

func (d *DateTime) TimePtr() *time.Time

TimePtr returns a pointer to the DateTime's underlying time.Time, if any.

func (*DateTime) UnmarshalJSON

func (d *DateTime) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL