Skip to content

Commit

Permalink
database/sql/driver: clarify DefaultParameterConverter docs
Browse files Browse the repository at this point in the history
Fixes #11489

Change-Id: I887ebac2dcb772e73ee393891c487f694028aaf2
Reviewed-on: https://go-review.googlesource.com/18520
Reviewed-by: Russ Cox <rsc@golang.org>
  • Loading branch information
bradfitz committed Jan 13, 2016
1 parent 70ee525 commit e405c29
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/database/sql/driver/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,15 @@ func IsScanValue(v interface{}) bool {
// ValueConverter that's used when a Stmt doesn't implement
// ColumnConverter.
//
// DefaultParameterConverter returns the given value directly if
// IsValue(value). Otherwise integer type are converted to
// int64, floats to float64, and strings to []byte. Other types are
// an error.
// DefaultParameterConverter returns its argument directly if
// IsValue(arg). Otherwise, if the argument implements Valuer, its
// Value method is used to return a Value. As a fallback, the provided
// argument's underlying type is used to convert it to a Value:
// underlying integer types are converted to int64, floats to float64,
// and strings to []byte. If the argument is a nil pointer,
// ConvertValue returns a nil Value. If the argument is a non-nil
// pointer, it is dereferenced and ConvertValue is called
// recursively. Other types are an error.
var DefaultParameterConverter defaultConverter

type defaultConverter struct{}
Expand Down

0 comments on commit e405c29

Please sign in to comment.