github.com/kotovmak/go-admin@v1.1.1/modules/db/statement_test.go (about) 1 package db 2 3 import ( 4 "database/sql" 5 "testing" 6 7 _ "github.com/kotovmak/go-admin/modules/db/drivers/mssql" 8 _ "github.com/kotovmak/go-admin/modules/db/drivers/postgres" 9 "github.com/magiconair/properties/assert" 10 ) 11 12 func testSQLWhereIn(t *testing.T, conn Connection) { 13 14 item, _ := WithDriver(conn).Table("goadmin_users").WhereIn("id", []interface{}{"1", "2"}).First() 15 assert.Equal(t, len(item), 2) 16 17 _, _ = WithDriver(conn).WithTransaction(func(tx *sql.Tx) (e error, i map[string]interface{}) { 18 item, _ := WithDriver(conn).WithTx(tx).Table("goadmin_users").WhereIn("id", []interface{}{"1", "2"}).All() 19 assert.Equal(t, len(item), 2) 20 return nil, nil 21 }) 22 } 23 24 func testSQLCount(t *testing.T, conn Connection) { 25 count, _ := WithDriver(conn).Table("goadmin_users").Count() 26 assert.Equal(t, count, int64(2)) 27 } 28 29 // TODO 30 func testSQLSelect(t *testing.T, conn Connection) {} 31 32 // TODO 33 func testSQLOrderBy(t *testing.T, conn Connection) {} 34 35 // TODO 36 func testSQLGroupBy(t *testing.T, conn Connection) {} 37 38 // TODO 39 func testSQLSkip(t *testing.T, conn Connection) {} 40 41 // TODO 42 func testSQLTake(t *testing.T, conn Connection) {} 43 44 // TODO 45 func testSQLWhere(t *testing.T, conn Connection) {} 46 47 // TODO 48 func testSQLWhereNotIn(t *testing.T, conn Connection) {} 49 50 // TODO 51 func testSQLFind(t *testing.T, conn Connection) {} 52 53 // TODO 54 func testSQLSum(t *testing.T, conn Connection) {} 55 56 // TODO 57 func testSQLMax(t *testing.T, conn Connection) {} 58 59 // TODO 60 func testSQLMin(t *testing.T, conn Connection) {} 61 62 // TODO 63 func testSQLAvg(t *testing.T, conn Connection) {} 64 65 // TODO 66 func testSQLWhereRaw(t *testing.T, conn Connection) {} 67 68 // TODO 69 func testSQLUpdateRaw(t *testing.T, conn Connection) {} 70 71 // TODO 72 func testSQLLeftJoin(t *testing.T, conn Connection) {} 73 74 // TODO 75 func testSQLWithTransaction(t *testing.T, conn Connection) {} 76 77 // TODO 78 func testSQLWithTransactionByLevel(t *testing.T, conn Connection) {} 79 80 // TODO 81 func testSQLFirst(t *testing.T, conn Connection) {} 82 83 // TODO 84 func testSQLAll(t *testing.T, conn Connection) {} 85 86 // TODO 87 func testSQLShowColumns(t *testing.T, conn Connection) {} 88 89 // TODO 90 func testSQLShowTables(t *testing.T, conn Connection) {} 91 92 // TODO 93 func testSQLUpdate(t *testing.T, conn Connection) {} 94 95 // TODO 96 func testSQLDelete(t *testing.T, conn Connection) {} 97 98 // TODO 99 func testSQLExec(t *testing.T, conn Connection) {} 100 101 // TODO 102 func testSQLInsert(t *testing.T, conn Connection) {} 103 104 // TODO 105 func testSQLWrap(t *testing.T, conn Connection) {}