g4json

package
v0.72.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetJsonLeavesPath

func GetJsonLeavesPath(fieldDetailsSlice []FieldDetails) []string

to get all the leaves, including the blank slice [], blank map {}

func GetJsonNodesLevel

func GetJsonNodesLevel(fieldDetailsSlice []FieldDetails) int

func GetJsonNodesPath

func GetJsonNodesPath(fieldDetailsSlice []FieldDetails) []string

func TraverseFields

func TraverseFields(c chan FieldDetails, subPath []string, value interface{}, wg *sync.WaitGroup)

Note: some issues exposed: 1. all Json numbers's type is marked as float64, can not distinguish int with float64 2. if Json number is 1234.00, then the value in Go is 1234 once json.Unmarshal, lost the .00 3. as Json mumbers are treated as float64, it may result in some issue, like use sci a.xxxe+1yy to represent timestamp

Types

type FieldDetails

type FieldDetails struct {
	FieldPath    []string
	CurrValue    interface{}
	FieldType    string // the json supported types
	FieldSubType string // like ip/email/phone/etc.
}

func GetFieldsDetails

func GetFieldsDetails(valueSource interface{}) []FieldDetails

func GetJsonLeaves

func GetJsonLeaves(fieldDetailsSlice []FieldDetails) []FieldDetails

to get all the leaves, including the blank slice [], blank map {}

Jump to

Keyboard shortcuts

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