代码拉取完成,页面将自动刷新
ThinkORM is a simple and Powerful ORM for Go.
go get github.com/thinkoner/torm
config := torm.Config{
Driver: "mysql",
Dsn: "root:abc-123@tcp(127.0.0.1:3306)/test?charset=utf8&parseTime=true",
}
db, _ := torm.Open(config)
type User struct {
Name string `torm:"column:name"`
Gender string `torm:"column:gender"`
Addr string
BirthDate string
Balance float64
CreatedAt time.Time
UpdatedAt time.Time
}
func (u *User) TableName() string {
return "users"
}
var users []User
db.Table("users").
Where("gender", "M").
Where("name", "like", "%a%").
WhereColumn("created_at", "!=", "updated_at").
WhereIn("addr", []interface{}{"Columbia", "Alaska"}).
WhereBetween("birth_date", []interface{}{"1990-01-01", "1999-12-31"}).
Get(&users)
This project is licensed under the Apache 2.0 license.
If you have any issues or feature requests, please contact us. PR is welcomed.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。