Files
gf/geg/database/orm/mysql/gdb_insert.go

27 lines
399 B
Go
Raw Normal View History

package main
import (
"fmt"
"github.com/gogf/gf/g"
"time"
)
func main() {
db := g.DB()
// 开启调试模式以便于记录所有执行的SQL
db.SetDebug(true)
r, e := db.Table("user").Data(g.Map{
2019-06-12 21:06:57 +08:00
"passport": "1",
"password": "1",
"nickname": "1",
"create_time": time.Now(),
}).Insert()
if e != nil {
panic(e)
}
if r != nil {
fmt.Println(r.LastInsertId())
}
}