1 Star 0 Fork 0

guxk / xorm

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
find.go 722 Bytes
一键复制 编辑 原始数据 按行查看 历史
guxk 提交于 2023-08-02 21:09 . 修改仓库地址
package main
import (
"fmt"
"os"
"time"
"gitee.com/guxk/xorm"
_ "github.com/mattn/go-sqlite3"
)
// User describes a user
type User struct {
Id int64
Name string
Created time.Time `xorm:"created"`
Updated time.Time `xorm:"updated"`
}
func main() {
f := "conversion.db"
os.Remove(f)
orm, err := xorm.NewEngine("sqlite3", f)
if err != nil {
fmt.Println(err)
return
}
orm.ShowSQL(true)
err = orm.CreateTables(&User{})
if err != nil {
fmt.Println(err)
return
}
_, err = orm.Insert(&User{Id: 1, Name: "xlw"})
if err != nil {
fmt.Println(err)
return
}
users := make([]User, 0)
err = orm.Find(&users)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(users)
}
1
https://gitee.com/guxk/xorm.git
git@gitee.com:guxk/xorm.git
guxk
xorm
xorm
v1.1.0

搜索帮助

53164aa7 5694891 3bd8fe86 5694891