参考帮助文档 [自动映射的规则](http://gobook.io/read/go-xorm/manual-zh-cn/chapter-02/4.columns.html) 中的说明 > 如果field名称为Id而且类型为int64并且没有定义tag,则会被xorm视为主键,并且拥有自增属性。如果想用Id以外的名字或非int64类型做为主键名,必须在对应的Tag上加上xorm:"pk"来定义主键,加上xorm:"autoincr"作为自增。这里需要注意的是,有些数据库并不允许非主键的自增属性。 因此在使用`core.GonicMapper`时,忽略了ID主键 |
||
---|---|---|
docs | ||
examples | ||
.gitignore | ||
.gitmodules | ||
.gopmfile | ||
CONTRIBUTING.md | ||
LICENSE | ||
README.md | ||
README_CN.md | ||
VERSION | ||
doc.go | ||
engine.go | ||
error.go | ||
gen_reserved.sh | ||
goracle_driver.go | ||
helpers.go | ||
logger.go | ||
lru_cacher.go | ||
memroy_store.go | ||
mssql_dialect.go | ||
mymysql_driver.go | ||
mysql_dialect.go | ||
mysql_driver.go | ||
oci8_driver.go | ||
odbc_driver.go | ||
oracle_dialect.go | ||
pg_reserved.txt | ||
postgres_dialect.go | ||
pq_driver.go | ||
processors.go | ||
rows.go | ||
session.go | ||
sqlite3_dialect.go | ||
sqlite3_driver.go | ||
statement.go | ||
syslogger.go | ||
xorm.go |
README.md
Xorm is a simple and powerful ORM for Go.
Features
-
Struct <-> Table Mapping Support
-
Chainable APIs
-
Transaction Support
-
Both ORM and raw SQL operation Support
-
Sync database schema Support
-
Query Cache speed up
-
Database Reverse support, See Xorm Tool README
-
Simple cascade loading support
-
Optimistic Locking support
Drivers Support
Drivers for Go's sql package which currently support database/sql includes:
-
MyMysql: github.com/ziutek/mymysql/godrv
-
SQLite: github.com/mattn/go-sqlite3
-
Postgres: github.com/lib/pq
-
MsSql: github.com/lunny/godbc
Changelog
-
v0.4.1 Features:
- Add deleted xorm tag for soft delete and add unscoped
-
v0.4.0 RC1 Changes:
- moved xorm cmd to github.com/go-xorm/cmd
- refactored general DB operation a core lib at github.com/go-xorm/core
- moved tests to github.com/go-xorm/tests github.com/go-xorm/tests
Improvements:
- Prepared statement cache
- Add Incr API
- Specify Timezone Location
Installation
If you have gopm installed,
gopm get github.com/go-xorm/xorm
Or
go get github.com/go-xorm/xorm
Documents
Cases
Discuss
Please visit Xorm on Google Groups
Contributing
If you want to pull request, please see CONTRIBUTING
LICENSE
BSD License http://creativecommons.org/licenses/BSD/