Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

v0 source pure

Package jsonw builds JSON text for realm query endpoints.

Overview

Package jsonw builds JSON text for realm query endpoints.

Values are plain strings holding encoded JSON, composed with Obj and Arr:

Example
1jsonw.Obj(
2	"id", jsonw.Uint(b.ID),
3	"title", jsonw.String(b.Title),
4	"tags", jsonw.Strings(b.Tags),
5)

String escapes everything JSON requires and replaces invalid UTF-8, so user-supplied text can never break the document.

Constants 1

Functions 9

func Addresses

1func Addresses(as []address) string
source

Addresses encodes a list of addresses as strings.

func Arr

1func Arr(items []string) string
source

Arr builds an array from encoded values.

func Bool

1func Bool(v bool) string
source

Bool encodes v.

func Int

1func Int(n int64) string
source

Int encodes n. Values beyond JavaScript's safe integer range are encoded as strings so clients never lose precision.

func Obj

1func Obj(kv ...string) string
source

Obj builds an object from alternating keys and encoded values.

func String

1func String(s string) string
source

String encodes s as a JSON string.

func Strings

1func Strings(ss []string) string
source

Strings encodes a list of strings.

func Time

1func Time(t time.Time) string
source

Time encodes t as RFC 3339 in UTC, or null when zero.

func Uint

1func Uint(n uint64) string
source

Uint encodes n, as a string beyond JavaScript's safe integer range.

Dependencies

Imports 4

/p/g1lnkytfqcjwllws63gvf0mv9yt04aswy4y9amhm/guildhall/jsonw/v0

Imported by indexer

Source Files 2