example&comment update

This commit is contained in:
John Guo
2021-11-01 19:46:39 +08:00
parent c0c68d1e46
commit 79a233eb78
14 changed files with 43 additions and 36 deletions

View File

@ -4,20 +4,20 @@ import (
"fmt"
"github.com/gogf/gf/v2/os/gtime"
_ "github.com/denisenkom/go-mssqldb"
//_ "github.com/denisenkom/go-mssqldb"
"github.com/gogf/gf/v2/frame/g"
)
func main() {
type Table2 struct {
Id string `orm:"id;pr" json:"id"` //ID
Createtime gtime.Time `orm:"createtime" json:"createtime"` //创建时间
Updatetime gtime.Time `orm:"updatetime" json:"updatetime"` //更新时间
CreateTime gtime.Time `orm:"createtime" json:"createtime"` //创建时间
UpdateTime gtime.Time `orm:"updatetime" json:"updatetime"` //更新时间
}
var table2 Table2
err := g.DB().Table("table2").Where("id=?", 1).Struct(&table2)
err := g.DB().Model("table2").Where("id", 1).Scan(&table2)
if err != nil {
panic(err)
}
fmt.Println(table2.Createtime)
fmt.Println(table2.CreateTime)
}