• ORM Test
    • MySQL
    • Sqlite3
    • PostgreSQL

    ORM Test

    测试代码参见

    • 表定义 models_test.go
    • 测试用例 orm_test.go

    MySQL

    1. mysql -u root -e 'create database orm_test;'
    2. export ORM_DRIVER=mysql
    3. export ORM_SOURCE="root:@/orm_test?charset=utf8"
    4. go test -v github.com/astaxie/beego/orm

    Sqlite3

    1. touch /path/to/orm_test.db
    2. export ORM_DRIVER=sqlite3
    3. export ORM_SOURCE=/path/to/orm_test.db
    4. go test -v github.com/astaxie/beego/orm

    PostgreSQL

    1. psql -c 'create database orm_test;' -U postgres
    2. export ORM_DRIVER=postgres
    3. export ORM_SOURCE="user=postgres dbname=orm_test sslmode=disable"
    4. go test -v github.com/astaxie/beego/orm