jyp

package
v0.0.0-...-79273a2 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSON_value

type JSON_value struct {
	ValType rune

	// ...... these values represent a Json elem's value - and one of them is filled only.. ..........
	ValObject map[string]JSON_value
	ValArray  []JSON_value

	ValBool bool // true, false

	ValRunes []rune // the parsed string. \n means 1 char here, for example

	ValNumberInt   int     // an integer JSON value is stored here
	ValNumberFloat float64 // a float JSON value is saved here
}

What if this is re-organised? JSON_value has only an Id, and every different type has a special storage? with that idea, 30ms can be saved, but the code becomes more complex

func JsonParse

func JsonParse(srcStr string) (JSON_value, []error)

func NewArr

func NewArr(elems ...JSON_value) JSON_value

newArray creation, with possible children

func NewBool

func NewBool(val bool) JSON_value

func NewNull

func NewNull() JSON_value

func NewNumFloat

func NewNumFloat(num float64) JSON_value

func NewNumInt

func NewNumInt(num int) JSON_value

func NewObj

func NewObj() JSON_value

func NewStr

func NewStr(text string) JSON_value

new string object from simple Go string (interpreted)

func NewString__rawToInterpreted

func NewString__rawToInterpreted(text []rune, errorsCollected []error) (JSON_value, []error)

raw: the string needs to be interpreted. "a\tb": \t represents 2 chars, it needs to be interpreted.

func (JSON_value) ArrAppend

func (v JSON_value) ArrAppend(value JSON_value) error

func (JSON_value) ArrDelete

func (v JSON_value) ArrDelete(indexUnwanted int) error

func (JSON_value) ArrGet

func (v JSON_value) ArrGet(index int) (JSON_value, error)

func (JSON_value) ArrInsert

func (v JSON_value) ArrInsert(index int, newVal JSON_value) error

func (JSON_value) ArrUpdate

func (v JSON_value) ArrUpdate(valueUpdated JSON_value, index int) error

func (JSON_value) ObjDelete

func (v JSON_value) ObjDelete(key string) error

func (JSON_value) ObjInsert

func (v JSON_value) ObjInsert(key string, value JSON_value) error

func (JSON_value) ObjPathGet

func (v JSON_value) ObjPathGet(keysMerged string) (JSON_value, error)

func (JSON_value) ObjPathGet_byKeys

func (v JSON_value) ObjPathGet_byKeys(keysEmbedded []string) (JSON_value, error)

func (JSON_value) ObjPathSet

func (v JSON_value) ObjPathSet(keysMerged string, value JSON_value, autoCreateChildren bool) error

//////////////////////////////////////////////////////////////////////////////////// if autoCreateChildren == true, a complex path can be added, and if the Children doesn't exist, the func creates it recursively

func (JSON_value) Repr

func (v JSON_value) Repr(indentationLength ...int) string

example usage: Repr(2) means: use " " 2 spaces as indentation if ind otherwise a simple formatted output REPR: how json elem is represented in a json source code: a "string" for example is quoted.

func (JSON_value) Repr_tuned

func (v JSON_value) Repr_tuned(indent string, level int) string

tunable repr: with this, tabulator can be used for example instead of spaces as indent, level 0 means left align - if higher level is used, the output will be moved to right on the screen

func (JSON_value) ValObject_keys_sorted

func (v JSON_value) ValObject_keys_sorted() []string

Jump to

Keyboard shortcuts

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