example names change

This commit is contained in:
John 2020-03-22 12:49:46 +08:00
parent a5e048eb5f
commit 75dc1d82c1
9 changed files with 25 additions and 25 deletions

View File

@ -13,7 +13,7 @@ import (
"github.com/gogf/gf/container/garray"
)
func Example_Basic() {
func Example_basic() {
// A normal array.
a := garray.New()
@ -72,7 +72,7 @@ func Example_Basic() {
// []
}
func Example_Rand() {
func Example_rand() {
array := garray.NewFrom([]interface{}{1, 2, 3, 4, 5, 6, 7, 8, 9})
// Randomly retrieve and return 2 items from the array.
@ -84,7 +84,7 @@ func Example_Rand() {
fmt.Println(array.PopRand())
}
func Example_PopItem() {
func Example_popItem() {
array := garray.NewFrom([]interface{}{1, 2, 3, 4, 5, 6, 7, 8, 9})
// Any Pop* functions pick, delete and return the item from array.
@ -101,7 +101,7 @@ func Example_PopItem() {
// [7 8]
}
func Example_MergeArray() {
func Example_mergeArray() {
array1 := garray.NewFrom([]interface{}{1, 2})
array2 := garray.NewFrom([]interface{}{3, 4})
slice1 := []interface{}{5, 6}
@ -120,7 +120,7 @@ func Example_MergeArray() {
// [1 2 1 2 3 4 5 6 7 8 9 0]
}
func Example_Filter() {
func Example_filter() {
array1 := garray.NewFrom(g.Slice{0, 1, 2, nil, "", g.Slice{}, "john"})
array2 := garray.NewFrom(g.Slice{0, 1, 2, nil, "", g.Slice{}, "john"})
fmt.Printf("%#v\n", array1.FilterNil().Slice())

View File

@ -6,7 +6,7 @@ import (
"github.com/gogf/gf/container/gmap"
)
func Example_NormalBasic() {
func Example_normalBasic() {
m := gmap.New()
//Add data
@ -61,7 +61,7 @@ func Example_NormalBasic() {
fmt.Println(m.Size())
}
func Example_NormalMerge() {
func Example_normalMerge() {
m1 := gmap.New()
m2 := gmap.New()
m1.Set("key1", "val1")

View File

@ -11,7 +11,7 @@ import (
"github.com/gogf/gf/encoding/gjson"
)
func Example_ConversionNormalFormats() {
func Example_conversionNormalFormats() {
data :=
`{
"users" : {
@ -59,7 +59,7 @@ func Example_ConversionNormalFormats() {
// count = 1.0
}
func Example_ConversionGetStruct() {
func Example_conversionGetStruct() {
data :=
`{
"users" : {
@ -85,7 +85,7 @@ func Example_ConversionGetStruct() {
// &{Count:1 Array:[John Ming]}
}
func Example_ConversionToStruct() {
func Example_conversionToStruct() {
data :=
`
{

View File

@ -11,7 +11,7 @@ import (
"github.com/gogf/gf/encoding/gjson"
)
func Example_DataSetCreate1() {
func Example_dataSetCreate1() {
j := gjson.New(nil)
j.Set("name", "John")
j.Set("score", 99.5)
@ -27,7 +27,7 @@ func Example_DataSetCreate1() {
// {"name":"John","score":99.5}
}
func Example_DataSetCreate2() {
func Example_dataSetCreate2() {
j := gjson.New(nil)
for i := 0; i < 5; i++ {
j.Set(fmt.Sprintf(`%d.id`, i), i)
@ -39,7 +39,7 @@ func Example_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 Example_DataSetRuntimeEdit() {
func Example_dataSetRuntimeEdit() {
data :=
`{
"users" : {

View File

@ -12,21 +12,21 @@ import (
"github.com/gogf/gf/encoding/gjson"
)
func Example_LoadJson() {
func Example_loadJson() {
jsonFilePath := gdebug.TestDataPath("json", "data1.json")
j, _ := gjson.Load(jsonFilePath)
fmt.Println(j.Get("name"))
fmt.Println(j.Get("score"))
}
func Example_LoadXml() {
func Example_loadXml() {
jsonFilePath := gdebug.TestDataPath("xml", "data1.xml")
j, _ := gjson.Load(jsonFilePath)
fmt.Println(j.Get("doc.name"))
fmt.Println(j.Get("doc.score"))
}
func Example_LoadContent() {
func Example_loadContent() {
jsonContent := `{"name":"john", "score":"100"}`
j, _ := gjson.LoadContent(jsonContent)
fmt.Println(j.Get("name"))

View File

@ -11,7 +11,7 @@ import (
"github.com/gogf/gf/encoding/gjson"
)
func Example_NewFromJson() {
func Example_newFromJson() {
jsonContent := `{"name":"john", "score":"100"}`
j := gjson.New(jsonContent)
fmt.Println(j.Get("name"))
@ -21,7 +21,7 @@ func Example_NewFromJson() {
// 100
}
func Example_NewFromXml() {
func Example_newFromXml() {
jsonContent := `<?xml version="1.0" encoding="UTF-8"?><doc><name>john</name><score>100</score></doc>`
j := gjson.New(jsonContent)
// Note that there's root node in the XML content.
@ -32,7 +32,7 @@ func Example_NewFromXml() {
// 100
}
func Example_NewFromStruct() {
func Example_newFromStruct() {
type Me struct {
Name string `json:"name"`
Score int `json:"score"`
@ -49,7 +49,7 @@ func Example_NewFromStruct() {
// 100
}
func Example_NewFromStructWithTag() {
func Example_newFromStructWithTag() {
type Me struct {
Name string `tag:"name"`
Score int `tag:"score"`

View File

@ -11,7 +11,7 @@ import (
"github.com/gogf/gf/encoding/gjson"
)
func Example_PatternGet() {
func Example_patternGet() {
data :=
`{
"users" : {
@ -31,7 +31,7 @@ func Example_PatternGet() {
// John Score: 99.5
}
func Example_PatternCustomSplitChar() {
func Example_patternCustomSplitChar() {
data :=
`{
"users" : {
@ -52,7 +52,7 @@ func Example_PatternCustomSplitChar() {
// John Score: 99.5
}
func Example_PatternViolenceCheck() {
func Example_patternViolenceCheck() {
data :=
`{
"users" : {

View File

@ -13,7 +13,7 @@ import (
"github.com/gogf/gf/os/glog"
)
func ExampleCron_AddSingleton() {
func Example_cronAddSingleton() {
gcron.AddSingleton("* * * * * *", func() {
glog.Println("doing")
time.Sleep(2 * time.Second)

View File

@ -13,7 +13,7 @@ import (
"github.com/gogf/gf/os/gtimer"
)
func ExampleAdd() {
func Example_add() {
now := time.Now()
interval := 1400 * time.Millisecond
gtimer.Add(interval, func() {