crep

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package crep ("see-rep") contains a utility for producing a Canonical REPresentation of a value type and for comparing objects using a fuzzy equivalence relationship.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equal

func Equal(a, b any) (bool, error)

Equal returns true if the two values are canonically equal. Two values are equal if their Canonical representations are equal.

Types

type Value

type Value any

A Value is one of:

  • nil
  • string, possibly numeric in nature
  • bool
  • []Value
  • map[string]Value

func Canonical

func Canonical(value any) (Value, error)

Canonical returns a canonical, JSON-esque representation of an input value. The values returned by this function will, in general, agree with the changefeed encoding for that value type. Furthermore, numbers will be converted to a string representation, so that they may be presented to the script runtime without loss of precision.

func Unmarshal

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

Unmarshal should be used instead of json.Unmarshal to ensure that numeric types are decoded with minimum loss of precision.

Jump to

Keyboard shortcuts

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