Documentation
¶
Overview ¶
Package jsonlazy implements delayed JSON encoding for values that do not implement json.Marshaler interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Marshaler ¶
type Marshaler struct {
// contains filtered or unexported fields
}
Marshaler implements a delayed JSON encoding for values.
func NewMarshaler ¶
func NewMarshaler(v interface{}) *Marshaler
NewMarshaler returns a new Marshaler for the given value.
func (*Marshaler) MarshalJSON ¶
MarshalJSON implemnets the json.Marshaler interface.
func (*Marshaler) Once ¶
func (m *Marshaler) Once() *OnceMarshaler
Once is a shorthand for jsonlazy.Once(m).
type OnceMarshaler ¶
type OnceMarshaler struct {
// contains filtered or unexported fields
}
OnceMarshaler is a json.Marshaler that caches the result of MarshalJSON call.
func Once ¶
func Once(m json.Marshaler) *OnceMarshaler
Once returns a new marshaler that caches the result of MarshalJSON call. That is, it calls MarshalJSON at most once.
func (*OnceMarshaler) MarshalJSON ¶
func (m *OnceMarshaler) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
Click to show internal directories.
Click to hide internal directories.