mirror of
https://github.com/gogf/gf.git
synced 2025-04-05 11:18:50 +08:00
24 lines
546 B
Go
24 lines
546 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/gogf/gf/v2/os/gtime"
|
|
|
|
_ "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"` //更新时间
|
|
}
|
|
var table2 Table2
|
|
err := g.DB().Table("table2").Where("id=?", 1).Struct(&table2)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
fmt.Println(table2.Createtime)
|
|
}
|