fjson

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package fjson provides converters 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

Alias      types package    fjson package         JSON representation

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

Scalar types

Alias      types package    fjson package         JSON representation

double     float64          *fjson.doubleType     {"$f": JSON number} or {"$f": "Infinity|-Infinity|NaN"}
string     string           *fjson.stringType     JSON string
binData    types.Binary     *fjson.binaryType     {"$b": "<base 64 string>", "s": <subtype number>}
objectId   types.ObjectID   *fjson.objectIDType   {"$o": "<ObjectID as 24 character hex string"}
bool       bool             *fjson.boolType       JSON true / false values
date       time.Time        *fjson.dateTimeType   {"$d": milliseconds since epoch as JSON number}
null       types.NullType   *fjson.nullType       JSON null
regex      types.Regex      *fjson.regexType      {"$r": "<string without terminating 0x0>", "o": "<string without terminating 0x0>"}
int        int32            *fjson.int32Type      JSON number
timestamp  types.Timestamp  *fjson.timestampType  {"$t": "<number as string>"}
long       int64            *fjson.int64Type      {"$l": "<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.

Types

This section is empty.

Jump to

Keyboard shortcuts

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