mirror of
https://gitee.com/johng/gf.git
synced 2024-12-01 03:38:35 +08:00
23 lines
328 B
Go
23 lines
328 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"github.com/gogf/gf/frame/g"
|
|
)
|
|
|
|
func main() {
|
|
type Student struct {
|
|
Id *g.Var
|
|
Name *g.Var
|
|
Scores *g.Var
|
|
}
|
|
s := Student{
|
|
Id: g.NewVar(1),
|
|
Name: g.NewVar("john"),
|
|
Scores: g.NewVar([]int{100, 99, 98}),
|
|
}
|
|
b, _ := json.Marshal(s)
|
|
fmt.Println(string(b))
|
|
}
|