IJsonRead支持Value, 泛读取数据
This commit is contained in:
1 parent
1124ff6a33
commit
042aad254b
3 files changed
+30
No files matched your search
@@ -118,3 +118,9 @@ func (g *gjsonRead) ArrayWithReceiver(dataPath string, receiver any) error {
|
||||
}
|
||||
return serialize.JSON.UnmarshalWithNumber([]byte(strVal), receiver)
|
||||
}
|
||||
func (g *gjsonRead) Value(dataPath string, dataType string, defaultValue any) (any, error) {
|
||||
if len(dataType) == 0 {
|
||||
dataType = g.Type(dataPath)
|
||||
}
|
||||
return gjson_hack.Value(consts.DataType(dataType), g.gjsonResult.Get(dataPath), defaultValue)
|
||||
}
|
||||