File tree Expand file tree Collapse file tree 4 files changed +15
-4
lines changed
Expand file tree Collapse file tree 4 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -32,17 +32,21 @@ See **.travis.yml** for supported **go** versions.
3232Different use case, is to functionally test with a real database - [ go-txdb] ( https://github.com/DATA-DOG/go-txdb )
3333all database related actions are isolated within a single transaction so the database can remain in the same state.
3434
35- See implementation examples:
35+ See implementation examples:
3636
3737- [ blog API server] ( https://github.com/DATA-DOG/go-sqlmock/tree/master/examples/blog )
3838- [ the same orders example] ( https://github.com/DATA-DOG/go-sqlmock/tree/master/examples/orders )
3939
40- ### Something you may want to test
40+ ### Something you may want to test, assuming you use the [ go-mysql-driver ] ( https://github.com/go-sql-driver/mysql )
4141
4242``` go
4343package main
4444
45- import " database/sql"
45+ import (
46+ " database/sql"
47+
48+ _ " github.com/go-sql-driver/mysql"
49+ )
4650
4751func recordStats (db *sql .DB , userID , productID int64 ) (err error ) {
4852 tx , err := db.Begin ()
Original file line number Diff line number Diff line change 11package main
22
3- import "database/sql"
3+ import (
4+ "database/sql"
5+
6+ _ "github.com/go-sql-driver/mysql"
7+ )
48
59func recordStats (db * sql.DB , userID , productID int64 ) (err error ) {
610 tx , err := db .Begin ()
Original file line number Diff line number Diff line change 44 "database/sql"
55 "encoding/json"
66 "net/http"
7+
8+ _ "github.com/go-sql-driver/mysql"
79)
810
911type api struct {
Original file line number Diff line number Diff line change 66 "log"
77
88 "github.com/kisielk/sqlstruct"
9+ _ "github.com/go-sql-driver/mysql"
910)
1011
1112const ORDER_PENDING = 0
You can’t perform that action at this time.
0 commit comments