fjson

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package fjson provides converters from/to FJSON (JSON with some extensions) for built-in and `types` types.

See contributing guidelines and documentation for package `types` for details.

Mapping

Composite types

*types.Document  {"$k": ["<key 1>", "<key 2>", ...], "<key 1>": <value 1>, "<key 2>": <value 2>, ...}
*types.Array     JSON array

Scalar types

float64          {"$f": JSON number} or {"$f": "Infinity|-Infinity|NaN"}
string           JSON string
types.Binary     {"$b": "<base 64 string>", "s": <subtype number>}
types.ObjectID   {"$o": "<ObjectID as 24 character hex string"}
bool             JSON true / false values
time.Time        {"$d": milliseconds since epoch as JSON number}
types.NullType   JSON null
types.Regex      {"$r": "<string without terminating 0x0>", "o": "<string without terminating 0x0>"}
int32            JSON number
types.Timestamp  {"$t": "<number as string>"}
int64            {"$l": "<number as string>"}
TODO Decimal128  {"$n": "<number as string>"}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(v any) ([]byte, error)

Marshal encodes given built-in or types' package value into fjson.

func Unmarshal

func Unmarshal(data []byte) (any, error)

Unmarshal decodes the given fjson-encoded data.

Types

This section is empty.

Jump to

Keyboard shortcuts

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