mirror of
https://github.com/zhashkevych/go-sqlxmock.git
synced 2024-11-16 17:41:57 +02:00
support for usage of sql.Out as a param value
This commit is contained in:
parent
ef0bdf231a
commit
1dd355d63c
@ -114,8 +114,3 @@ func (stmt *statement) QueryContext(ctx context.Context, args []driver.NamedValu
|
||||
|
||||
// @TODO maybe add ExpectedBegin.WithOptions(driver.TxOptions)
|
||||
|
||||
// CheckNamedValue meets https://golang.org/pkg/database/sql/driver/#NamedValueChecker
|
||||
func (c *sqlmock) CheckNamedValue(nv *driver.NamedValue) (err error) {
|
||||
nv.Value, err = c.converter.ConvertValue(nv.Value)
|
||||
return err
|
||||
}
|
||||
|
11
sqlmock_go18_19.go
Normal file
11
sqlmock_go18_19.go
Normal file
@ -0,0 +1,11 @@
|
||||
// +build go1.8,!go1.9
|
||||
|
||||
package sqlmock
|
||||
|
||||
import "database/sql/driver"
|
||||
|
||||
// CheckNamedValue meets https://golang.org/pkg/database/sql/driver/#NamedValueChecker
|
||||
func (c *sqlmock) CheckNamedValue(nv *driver.NamedValue) (err error) {
|
||||
nv.Value, err = c.converter.ConvertValue(nv.Value)
|
||||
return err
|
||||
}
|
19
sqlmock_go19.go
Normal file
19
sqlmock_go19.go
Normal file
@ -0,0 +1,19 @@
|
||||
// +build go1.9
|
||||
|
||||
package sqlmock
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"database/sql/driver"
|
||||
)
|
||||
|
||||
// CheckNamedValue meets https://golang.org/pkg/database/sql/driver/#NamedValueChecker
|
||||
func (c *sqlmock) CheckNamedValue(nv *driver.NamedValue) (err error) {
|
||||
switch nv.Value.(type) {
|
||||
case sql.Out:
|
||||
return nil
|
||||
default:
|
||||
nv.Value, err = c.converter.ConvertValue(nv.Value)
|
||||
return err
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user