1 Star 2 Fork 1

thinkgo / torm

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

ThinkORM

ThinkORM is a simple and Powerful ORM for Go.

Build Status Go Report Card Go Report Card GoDoc Join the chat Latest Stable Version License

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

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.

Comments ( 0 )

Sign in for post a comment

About

The Golang ORM library for web artisans. spread retract
Apache-2.0
Cancel

Releases

No release

Contributors

All

Activities

load more
can not load any more
1
https://gitee.com/thinkgo/torm.git
git@gitee.com:thinkgo/torm.git
thinkgo
torm
torm
master

Search