I'm trying to write a wrapper for database/sql/driver to be able to use it
in tests. The general idea for now is to be able to say to this wrapper
driver to fail Nth query. I have done proof of concept but I can't seem to
solve a problem of wrapping transaction. For now my code looks like this:


I can force Commit and Rollback to fail but have problems writing
passthrough methods for Query, Exec, ...


And this is how I initialize it in the code:

import (

var drv driver.Driver = &godrv.Driver{}
testDbWr = dbwrap.New("testing", drv)
// use the new name to connect
testDb, err = sql.Open("testing", connectString)

Do you guys have any suggestions how to do it?

You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 3 | next ›
Discussion Overview
groupgolang-nuts @
postedApr 4, '14 at 11:30p
activeApr 5, '14 at 10:30a

2 users in discussion

Ralph Zajac: 2 posts Tamás Gulácsi: 1 post



site design / logo © 2021 Grokbase