mirror of
https://gitee.com/johng/gf
synced 2026-07-07 06:15:15 +08:00
32 lines
462 B
Go
32 lines
462 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/gogf/gf/encoding/gjson"
|
|
"github.com/gogf/gf/frame/g"
|
|
"github.com/gogf/gf/util/gconv"
|
|
)
|
|
|
|
type Item struct {
|
|
GroupId int
|
|
Interval string
|
|
MetricName string
|
|
Url string
|
|
}
|
|
|
|
func main() {
|
|
j, err := gjson.Load("config.toml")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
m := j.GetMap("active-pulling")
|
|
//g.Dump(m)
|
|
|
|
newm := make(map[string][]Item)
|
|
err = gconv.MapStructs(m, &newm)
|
|
fmt.Println(err)
|
|
g.Dump(newm)
|
|
|
|
}
|