FAQ
Hey

I'm already doing it. And my testing wrap already works. For most of the
methods I can create pass through methods in my "fake" driver. The problem
I have is with driver.Conn and Begin() (Tx, error) method. In my code I do
this:

func (this *conn) Begin() (driver.Tx, error) {
txn, err := this.Conn.Begin()
return &tx{txn}, err
}

Where I call proper driver's Begin() method but then I have only access to
Commit() and Rollback methods to intercept in my tx struct.

I was wondering if there is a way to return sql.Tx interface from my code
that calls the original driver whatever it is.


On Saturday, April 5, 2014 7:50:41 AM UTC+2, Tamás Gulácsi wrote:

See what is mymysql doing in its init(): it registers a function for a
name. You can do it also, for "testing".
--
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

Previous

Related Discussions

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

2 users in discussion

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

People

Translate

site design / logo © 2021 Grokbase