| package db |
|
|
| import ( |
| "database/sql" |
| "testing" |
|
|
| _ "github.com/GoAdminGroup/go-admin/modules/db/drivers/mssql" |
| _ "github.com/GoAdminGroup/go-admin/modules/db/drivers/postgres" |
| "github.com/magiconair/properties/assert" |
| ) |
|
|
| func testSQLWhereIn(t *testing.T, conn Connection) { |
|
|
| item, _ := WithDriver(conn).Table("goadmin_users").WhereIn("id", []interface{}{"1", "2"}).First() |
| assert.Equal(t, len(item), 2) |
|
|
| _, _ = WithDriver(conn).WithTransaction(func(tx *sql.Tx) (e error, i map[string]interface{}) { |
| item, _ := WithDriver(conn).WithTx(tx).Table("goadmin_users").WhereIn("id", []interface{}{"1", "2"}).All() |
| assert.Equal(t, len(item), 2) |
| return nil, nil |
| }) |
| } |
|
|
| func testSQLCount(t *testing.T, conn Connection) { |
| count, _ := WithDriver(conn).Table("goadmin_users").Count() |
| assert.Equal(t, count, int64(2)) |
| } |
|
|
| |
| func testSQLSelect(t *testing.T, conn Connection) {} |
|
|
| |
| func testSQLOrderBy(t *testing.T, conn Connection) {} |
|
|
| |
| func testSQLGroupBy(t *testing.T, conn Connection) {} |
|
|
| |
| func testSQLSkip(t *testing.T, conn Connection) {} |
|
|
| |
| func testSQLTake(t *testing.T, conn Connection) {} |
|
|
| |
| func testSQLWhere(t *testing.T, conn Connection) {} |
|
|
| |
| func testSQLWhereNotIn(t *testing.T, conn Connection) {} |
|
|
| |
| func testSQLFind(t *testing.T, conn Connection) {} |
|
|
| |
| func testSQLSum(t *testing.T, conn Connection) {} |
|
|
| |
| func testSQLMax(t *testing.T, conn Connection) {} |
|
|
| |
| func testSQLMin(t *testing.T, conn Connection) {} |
|
|
| |
| func testSQLAvg(t *testing.T, conn Connection) {} |
|
|
| |
| func testSQLWhereRaw(t *testing.T, conn Connection) {} |
|
|
| |
| func testSQLUpdateRaw(t *testing.T, conn Connection) {} |
|
|
| |
| func testSQLLeftJoin(t *testing.T, conn Connection) {} |
|
|
| |
| func testSQLWithTransaction(t *testing.T, conn Connection) {} |
|
|
| |
| func testSQLWithTransactionByLevel(t *testing.T, conn Connection) {} |
|
|
| |
| func testSQLFirst(t *testing.T, conn Connection) {} |
|
|
| |
| func testSQLAll(t *testing.T, conn Connection) {} |
|
|
| |
| func testSQLShowColumns(t *testing.T, conn Connection) {} |
|
|
| |
| func testSQLShowTables(t *testing.T, conn Connection) {} |
|
|
| |
| func testSQLUpdate(t *testing.T, conn Connection) {} |
|
|
| |
| func testSQLDelete(t *testing.T, conn Connection) {} |
|
|
| |
| func testSQLExec(t *testing.T, conn Connection) {} |
|
|
| |
| func testSQLInsert(t *testing.T, conn Connection) {} |
|
|
| |
| func testSQLWrap(t *testing.T, conn Connection) {} |
|
|