ijson

package
v0.8.9 Latest Latest
Warning

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

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

Documentation

Overview

implements incremental json format

Index

Constants

View Source
const (
	SetCommandStr    = "set"
	DelCommandStr    = "del"
	AppendCommandStr = "append"
)

Variables

This section is empty.

Functions

func ApplyCommand

func ApplyCommand(data any, command Command, budget int) (any, error)

func ApplyCommands

func ApplyCommands(data any, commands []Command, budget int) (any, error)

func CombineFn_ArrayAppend

func CombineFn_ArrayAppend(data any, value any, pp pathWithPos, opts SetPathOpts) (any, error)

func CombineFn_Inc

func CombineFn_Inc(data any, value any, pp pathWithPos, opts SetPathOpts) (any, error)

func CombineFn_Max

func CombineFn_Max(data any, value any, pp pathWithPos, opts SetPathOpts) (any, error)

func CombineFn_Min

func CombineFn_Min(data any, value any, pp pathWithPos, opts SetPathOpts) (any, error)

func CombineFn_SetUnless

func CombineFn_SetUnless(data any, value any, pp pathWithPos, opts SetPathOpts) (any, error)

func CompactIJson

func CompactIJson(fullData []byte, budget int) ([]byte, error)

func DeepEqual

func DeepEqual(v1 any, v2 any) bool

func FormatPath

func FormatPath(path Path) string

func GetPath

func GetPath(data any, path []any) (any, error)

func MakeBudgetError

func MakeBudgetError(errStr string, path Path, index int) error

func MakePathError

func MakePathError(errStr string, path Path, index int) error

func MakePathTypeError

func MakePathTypeError(path Path, index int) error

func MakeSetTypeError

func MakeSetTypeError(errStr string, path Path, index int) error

func NormalizeNumbers

func NormalizeNumbers(v any) any

func ParseSimplePath

func ParseSimplePath(input string) ([]any, error)

func SetPath

func SetPath(data any, path Path, value any, opts *SetPathOpts) (any, error)

func SetPathNoErr

func SetPathNoErr(data any, path Path, value any, opts *SetPathOpts) any

func ValidateAndMarshalCommand

func ValidateAndMarshalCommand(command Command) ([]byte, error)

func ValidatePath

func ValidatePath(path any) error

Types

type A

type A = []any

type BudgetError

type BudgetError struct {
	Err string
}

func (BudgetError) Error

func (e BudgetError) Error() string

type CombiningFunc

type CombiningFunc func(curValue any, newValue any, pp pathWithPos, opts SetPathOpts) (any, error)

type Command

type Command = map[string]any

func MakeAppendCommand

func MakeAppendCommand(path Path, value any) Command

func MakeDelCommand

func MakeDelCommand(path Path) Command

func MakeSetCommand

func MakeSetCommand(path Path, value any) Command

func ParseIJson

func ParseIJson(fullData []byte) ([]Command, error)

returns a list of commands

type M

type M = map[string]any

type Path

type Path = []any

type PathError

type PathError struct {
	Err string
}

func (PathError) Error

func (e PathError) Error() string

type SetPathOpts

type SetPathOpts struct {
	Budget    int // Budget 0 is unlimited (to set a 0 value, use -1)
	Force     bool
	Remove    bool
	CombineFn CombiningFunc
}

type SetTypeError

type SetTypeError struct {
	Err string
}

func (SetTypeError) Error

func (e SetTypeError) Error() string

Jump to

Keyboard shortcuts

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