ThinkORM:一个优雅的Go语言ORM框架

网友投稿 822 2022-10-24

ThinkORM:一个优雅的Go语言ORM框架

ThinkORM:一个优雅的Go语言ORM框架

ThinkORM

ThinkORM is a simple and Powerful ORM for Go.

Installation

go get github.com/thinkoner/torm

Quick start

Get the database connection:

config := torm.Config{ Driver: "mysql", Dsn: "root:abc-123@tcp(127.0.0.1:3306)/test?charset=utf8&parseTime=true", }db, _ := torm.Open(config)

Query Builder:

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 []Userdb.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)

License

This project is licensed under the Apache 2.0 license.

Contact

If you have any issues or feature requests, please contact us. PR is welcomed.

https://github.com/thinkoner/torm/issuesduanpier@gmail.com

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:连接数据库实现查询员工信息
下一篇:最易懂Spring循环依赖
相关文章

 发表评论

暂时没有评论,来抢沙发吧~