ordered

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package ordered gives the dynamic JSON members of a decoded Go value the key order of their JSON text.

Pi decodes a stored record with JSON.parse, so an object inside a dynamic member (a JsonValue such as a task's checkpoint or an entry's data) keeps the key order of the text. encoding/json decodes such a member into a Go map, which has no order. Restore replaces each dynamic member with the same text decoded into insertion-ordered objects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasDynamic

func HasDynamic(t reflect.Type) bool

HasDynamic reports whether a value of type t can hold a dynamic JSON member that Restore would replace.

func Restore

func Restore(target any, tree any)

Restore replaces every dynamic member of *target (a member whose static type is an empty interface) with the value at the same position in tree, the JSON text *target was decoded from, decoded with insertion-ordered objects (delta.DecodeJson). target must be a non-nil pointer. Members that decode themselves (json.Unmarshaler or encoding.TextUnmarshaler) keep their value. tree's values become part of *target, so the caller must not share tree.

Types

This section is empty.

Jump to

Keyboard shortcuts

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