mirror of
https://github.com/DATA-DOG/go-sqlmock.git
synced 2025-05-15 22:06:43 +02:00
Merge pull request #164 from theodesp/examples/go-sql-driver-imports
Examples/go sql driver imports
This commit is contained in:
commit
3f9954f6f6
@ -37,12 +37,16 @@ See implementation examples:
|
|||||||
- [blog API server](https://github.com/DATA-DOG/go-sqlmock/tree/master/examples/blog)
|
- [blog API server](https://github.com/DATA-DOG/go-sqlmock/tree/master/examples/blog)
|
||||||
- [the same orders example](https://github.com/DATA-DOG/go-sqlmock/tree/master/examples/orders)
|
- [the same orders example](https://github.com/DATA-DOG/go-sqlmock/tree/master/examples/orders)
|
||||||
|
|
||||||
### Something you may want to test
|
### Something you may want to test, assuming you use the [go-mysql-driver](https://github.com/go-sql-driver/mysql)
|
||||||
|
|
||||||
``` go
|
``` go
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "database/sql"
|
import (
|
||||||
|
"database/sql"
|
||||||
|
|
||||||
|
_ "github.com/go-sql-driver/mysql"
|
||||||
|
)
|
||||||
|
|
||||||
func recordStats(db *sql.DB, userID, productID int64) (err error) {
|
func recordStats(db *sql.DB, userID, productID int64) (err error) {
|
||||||
tx, err := db.Begin()
|
tx, err := db.Begin()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user