json

package
v1.36.178 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: BSD-3-Clause Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// Null is the string representation of a null value
	Null = "null"
)

Variables

This section is empty.

Functions

func NewCodec

func NewCodec() rpc.Codec

NewCodec returns a new json codec that will convert the first character of the method to uppercase

Types

type Float32 added in v0.1.1

type Float32 float32

func (Float32) MarshalJSON added in v0.1.1

func (f Float32) MarshalJSON() ([]byte, error)

func (*Float32) UnmarshalJSON added in v0.1.1

func (f *Float32) UnmarshalJSON(b []byte) error

type Float64 added in v0.1.1

type Float64 float64

func (Float64) MarshalJSON added in v0.1.1

func (f Float64) MarshalJSON() ([]byte, error)

func (*Float64) UnmarshalJSON added in v0.1.1

func (f *Float64) UnmarshalJSON(b []byte) error

type Time added in v1.36.178

type Time struct {
	// Seconds is seconds since the epoch.
	Seconds int64 `json:"seconds"`
	// Nanos is the nanosecond within that second.
	Nanos int32 `json:"nanos"`
	// Offset is seconds east of UTC.
	Offset int32 `json:"offset"`
}

Time is an instant, on a wire whose fields are offsets.

time.Time cannot be one. Its fields are all unexported, so a reply that holds one lays out with nothing in it — eight bytes pointing at an empty message — and a caller reads a zero it cannot tell from a zero that was sent. That is worse than a refusal: nothing fails and the value is simply absent.

The same instant as three numbers does have a layout. The JSON is byte for byte what time.Time's own marshaler writes, because the offset is all the rendering depends on: RFC 3339 spells a zero offset "Z" and any other one "+HH:MM", so carrying it is enough to put the instant back in the zone it was read in.

func NewTime added in v1.36.178

func NewTime(t time.Time) Time

NewTime is the instant t, as a value that can cross.

func (Time) MarshalJSON added in v1.36.178

func (t Time) MarshalJSON() ([]byte, error)

func (*Time) MarshalZAP added in v1.36.178

func (x *Time) MarshalZAP() ([]byte, error)

MarshalZAP writes Time from constant offsets.

func (Time) Time added in v1.36.178

func (t Time) Time() time.Time

Time is the instant, in the zone it was read in.

func (*Time) UnmarshalJSON added in v1.36.178

func (t *Time) UnmarshalJSON(b []byte) error

func (*Time) UnmarshalZAP added in v1.36.178

func (x *Time) UnmarshalZAP(data []byte) error

UnmarshalZAP reads Time out of the buffer that arrived.

type Uint8

type Uint8 uint8

func (Uint8) MarshalJSON

func (u Uint8) MarshalJSON() ([]byte, error)

func (*Uint8) UnmarshalJSON

func (u *Uint8) UnmarshalJSON(b []byte) error

type Uint16

type Uint16 uint16

func (Uint16) MarshalJSON

func (u Uint16) MarshalJSON() ([]byte, error)

func (*Uint16) UnmarshalJSON

func (u *Uint16) UnmarshalJSON(b []byte) error

type Uint32

type Uint32 uint32

func (Uint32) MarshalJSON

func (u Uint32) MarshalJSON() ([]byte, error)

func (*Uint32) UnmarshalJSON

func (u *Uint32) UnmarshalJSON(b []byte) error

type Uint64

type Uint64 uint64

func (Uint64) MarshalJSON

func (u Uint64) MarshalJSON() ([]byte, error)

func (*Uint64) UnmarshalJSON

func (u *Uint64) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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