improve gyaml with gopkg.in/yaml.v3; update unit test cases for gfile/gyaml/gtime/garray

This commit is contained in:
John
2019-08-01 17:12:58 +08:00
parent 06c16bf560
commit d188fbdf5a
14 changed files with 98 additions and 106 deletions

View File

@ -0,0 +1,30 @@
package main
import (
"fmt"
"github.com/gogf/gf/encoding/gyaml"
)
func main() {
var yamlStr string = `
#即表示url属性值
url: http://www.wolfcode.cn
#即表示server.host属性的值
server:
host: http://www.wolfcode.cn
#数组即表示server为[a,b,c]
server:
- 120.168.117.21
- 120.168.117.22
- 120.168.117.23
#常量
pi: 3.14 #定义一个数值3.14
hasChild: true #定义一个boolean值
name: '你好YAML' #定义一个字符串
`
i, err := gyaml.Decode([]byte(yamlStr))
fmt.Println(err)
fmt.Println(i)
}