mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
chore: upgrade dependencies to latest versions and fix security vulne… (#4237)
This PR includes the following updates and fixes: - **Dependency upgrades**: Updated all dependencies in `go.mod` to their latest versions to ensure compatibility and leverage the latest features and fixes. - **Security fixes**: - Resolved known vulnerabilities in `golang.org/x/net` by upgrading to the latest secure version. - Addressed security issues in `golang.org/x/crypto` by upgrading to the latest secure version. These changes improve the overall security and stability of the project. Please review the changes and ensure compatibility with the updated dependencies. --------- Co-authored-by: hailaz <739476267@qq.com>
This commit is contained in:
@ -12,7 +12,7 @@ import (
|
||||
"github.com/gogf/gf/v2/encoding/gjson"
|
||||
)
|
||||
|
||||
func ExampleConversionNormalFormats() {
|
||||
func ExampleJson_data() {
|
||||
data :=
|
||||
`{
|
||||
"users" : {
|
||||
@ -61,7 +61,7 @@ func ExampleConversionNormalFormats() {
|
||||
// count = 1.0
|
||||
}
|
||||
|
||||
func ExampleJson_ConversionGetStruct() {
|
||||
func ExampleJson_Get_data() {
|
||||
data :=
|
||||
`{
|
||||
"users" : {
|
||||
@ -87,7 +87,7 @@ func ExampleJson_ConversionGetStruct() {
|
||||
// &{Count:1 Array:[John Ming]}
|
||||
}
|
||||
|
||||
func ExampleJson_ConversionToStruct() {
|
||||
func ExampleJson_Scan_data() {
|
||||
data :=
|
||||
`
|
||||
{
|
||||
|
||||
@ -12,7 +12,7 @@ import (
|
||||
"github.com/gogf/gf/v2/encoding/gjson"
|
||||
)
|
||||
|
||||
func ExampleJson_Set_DataSetCreate1() {
|
||||
func ExampleJson_Set_j() {
|
||||
j := gjson.New(nil)
|
||||
j.Set("name", "John")
|
||||
j.Set("score", 99.5)
|
||||
@ -28,7 +28,7 @@ func ExampleJson_Set_DataSetCreate1() {
|
||||
// {"name":"John","score":99.5}
|
||||
}
|
||||
|
||||
func ExampleJson_Set_DataSetCreate2() {
|
||||
func ExampleJson_Set_sprintf() {
|
||||
j := gjson.New(nil)
|
||||
for i := 0; i < 5; i++ {
|
||||
j.Set(fmt.Sprintf(`%d.id`, i), i)
|
||||
@ -40,7 +40,7 @@ func ExampleJson_Set_DataSetCreate2() {
|
||||
// [{"id":0,"name":"student-0"},{"id":1,"name":"student-1"},{"id":2,"name":"student-2"},{"id":3,"name":"student-3"},{"id":4,"name":"student-4"}]
|
||||
}
|
||||
|
||||
func ExampleJson_DataSetRuntimeEdit() {
|
||||
func ExampleJson_Set_data() {
|
||||
data :=
|
||||
`{
|
||||
"users" : {
|
||||
|
||||
@ -116,7 +116,7 @@ func ExampleLoadContent() {
|
||||
// 100
|
||||
}
|
||||
|
||||
func ExampleLoadContent_UTF8BOM() {
|
||||
func ExampleLoadContent_jsonContent() {
|
||||
jsonContent := `{"name":"john", "score":"100"}`
|
||||
|
||||
content := make([]byte, 3, len(jsonContent)+3)
|
||||
@ -135,7 +135,7 @@ func ExampleLoadContent_UTF8BOM() {
|
||||
// 100
|
||||
}
|
||||
|
||||
func ExampleLoadContent_Xml() {
|
||||
func ExampleLoadContent_xml_content() {
|
||||
xmlContent := []byte(`
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<base>
|
||||
@ -206,21 +206,21 @@ func ExampleIsValidDataType() {
|
||||
// true
|
||||
}
|
||||
|
||||
func ExampleLoad_Xml() {
|
||||
func ExampleLoad_jsonFilePath() {
|
||||
jsonFilePath := gtest.DataPath("xml", "data1.xml")
|
||||
j, _ := gjson.Load(jsonFilePath)
|
||||
fmt.Println(j.Get("doc.name"))
|
||||
fmt.Println(j.Get("doc.score"))
|
||||
}
|
||||
|
||||
func ExampleLoad_Properties() {
|
||||
func ExampleLoadProperties() {
|
||||
jsonFilePath := gtest.DataPath("properties", "data1.properties")
|
||||
j, _ := gjson.Load(jsonFilePath)
|
||||
fmt.Println(j.Get("pr.name"))
|
||||
fmt.Println(j.Get("pr.score"))
|
||||
fmt.Println(j.Get("pr.sex"))
|
||||
|
||||
//Output:
|
||||
// Output:
|
||||
// john
|
||||
// 100
|
||||
// 0
|
||||
|
||||
@ -70,7 +70,7 @@ func ExampleNewWithOptions() {
|
||||
// engineer
|
||||
}
|
||||
|
||||
func ExampleNewWithOptions_UTF8BOM() {
|
||||
func ExampleNewWithOptions_jsonContent() {
|
||||
jsonContent := `{"name":"john", "score":"100"}`
|
||||
|
||||
content := make([]byte, 3, len(jsonContent)+3)
|
||||
@ -90,9 +90,9 @@ func ExampleNewWithOptions_UTF8BOM() {
|
||||
// 100
|
||||
}
|
||||
|
||||
func ExampleNew_Xml() {
|
||||
jsonContent := `<?xml version="1.0" encoding="UTF-8"?><doc><name>john</name><score>100</score></doc>`
|
||||
j := gjson.New(jsonContent)
|
||||
func ExampleNew_xmlContent() {
|
||||
xmlContent := `<?xml version="1.0" encoding="UTF-8"?><doc><name>john</name><score>100</score></doc>`
|
||||
j := gjson.New(xmlContent)
|
||||
// Note that there's root node in the XML content.
|
||||
fmt.Println(j.Get("doc.name"))
|
||||
fmt.Println(j.Get("doc.score"))
|
||||
@ -101,7 +101,7 @@ func ExampleNew_Xml() {
|
||||
// 100
|
||||
}
|
||||
|
||||
func ExampleNew_Struct() {
|
||||
func ExampleNew_me() {
|
||||
type Me struct {
|
||||
Name string `json:"name"`
|
||||
Score int `json:"score"`
|
||||
|
||||
@ -12,7 +12,7 @@ import (
|
||||
"github.com/gogf/gf/v2/encoding/gjson"
|
||||
)
|
||||
|
||||
func ExampleDecodeToJson_PatternGet() {
|
||||
func ExampleJson_get_data() {
|
||||
data :=
|
||||
`{
|
||||
"users" : {
|
||||
@ -32,7 +32,7 @@ func ExampleDecodeToJson_PatternGet() {
|
||||
// John Score: 99.5
|
||||
}
|
||||
|
||||
func ExampleDecodeToJson_PatternViolenceCheck() {
|
||||
func ExampleJson_SetViolenceCheck_data() {
|
||||
data :=
|
||||
`{
|
||||
"users" : {
|
||||
@ -50,7 +50,7 @@ func ExampleDecodeToJson_PatternViolenceCheck() {
|
||||
// Users Count: 101
|
||||
}
|
||||
|
||||
func ExampleJson_Get_MapSliceChange() {
|
||||
func ExampleJson_Get_jsonContent() {
|
||||
jsonContent := []byte(`{"map":{"key":"value"}, "slice":[59,90]}`)
|
||||
j, _ := gjson.LoadJson(jsonContent)
|
||||
m := j.Get("map").Map()
|
||||
|
||||
@ -746,7 +746,7 @@ func ExampleJson_UnmarshalJSON() {
|
||||
// map[Age:18 Name:John]
|
||||
}
|
||||
|
||||
func ExampleJson_UnmarshalValue_Yaml() {
|
||||
func ExampleJson_UnmarshalValue_yamlContent() {
|
||||
yamlContent :=
|
||||
`base:
|
||||
name: john
|
||||
@ -760,7 +760,7 @@ func ExampleJson_UnmarshalValue_Yaml() {
|
||||
// {"base":{"name":"john","score":100}}
|
||||
}
|
||||
|
||||
func ExampleJson_UnmarshalValue_Xml() {
|
||||
func ExampleJson_UnmarshalValue_xmlStr() {
|
||||
xmlStr := `<?xml version="1.0" encoding="UTF-8"?><doc><name>john</name><score>100</score></doc>`
|
||||
|
||||
j := gjson.New("")
|
||||
|
||||
Reference in New Issue
Block a user