Documentation
¶
Index ¶
- Variables
- func ArrayToMap[T comparable](node *Wrap, filter func(T) bool, extractor func(*Wrap) T) *orderedmap.OrderedMap[T, struct{}]
- func ArrayToSlice[T any](node *Wrap, filter func(T) bool, extractor func(*Wrap) T) []T
- func WrapBool(w *Wrap) bool
- func WrapFloat64(w *Wrap) float64
- func WrapInteger(w *Wrap) int
- func WrapInteger64(w *Wrap) int64
- func WrapRaw(w *Wrap) string
- func WrapRefString(w *Wrap) string
- func WrapString(w *Wrap) string
- type Wrap
- func Get(src []byte, path ...any) (*Wrap, error)
- func GetCopyFromString(src string, path ...any) (*Wrap, error)
- func GetFromString(src string, path ...any) (*Wrap, error)
- func GetWithOptions(src []byte, opts ast.SearchOptions, path ...any) (*Wrap, error)
- func Of(node ast.Node) *Wrap
- func OfPtr(node *ast.Node) *Wrap
- func WrapGet(w *Wrap, key string) *Wrap
- func WrapGetByPath(w *Wrap, path ...any) *Wrap
- func WrapIndex(w *Wrap, i int) *Wrap
- func (w *Wrap) Bool() bool
- func (w *Wrap) Float64() float64
- func (w *Wrap) Get(key string) *Wrap
- func (w *Wrap) GetByPath(path ...any) *Wrap
- func (w *Wrap) Index(i int) *Wrap
- func (w *Wrap) Integer() int
- func (w *Wrap) Integer64() int64
- func (w *Wrap) Raw() string
- func (w *Wrap) RefString() string
- func (w *Wrap) String() string
Constants ¶
This section is empty.
Variables ¶
var Config = Default
var Default = sonic.Config{ NoNullSliceOrMap: true, NoValidateJSONMarshaler: true, NoValidateJSONSkip: true, CompactMarshaler: true, CopyString: true, }.Froze()
var Empty = &Wrap{ast.NewNull()}
Empty - empty sonic node
Functions ¶
func ArrayToMap ¶
func ArrayToMap[T comparable](node *Wrap, filter func(T) bool, extractor func(*Wrap) T) *orderedmap.OrderedMap[T, struct{}]
ArrayToMap returns an orderedmap.OrderedMap of the results that pass the filter from the sonic node array, projected using the extractor func
func ArrayToSlice ¶
ArrayToSlice returns a slice of the results that pass the filter from the sonic node array, projected using the extractor func
func WrapFloat64 ¶
WrapFloat64 extracts a float64 value from the Wrap
func WrapInteger ¶
WrapInteger extracts an integer value from the Wrap
func WrapInteger64 ¶
WrapInteger64 extracts an int64 value from the Wrap
func WrapRefString ¶
WrapRefString extracts a string value from the Wrap (without copy)
func WrapString ¶
WrapString extracts a string value from the Wrap (with copy)
Types ¶
type Wrap ¶
func GetCopyFromString ¶
GetCopyFromString returns a Wrap for the node using the specified path
func GetFromString ¶
GetFromString returns a Wrap for the node using the specified path
func GetWithOptions ¶
GetWithOptions returns a Wrap for the node using the specified path and options
func WrapGetByPath ¶
WrapGetByPath returns a Wrap for the specified path