diff options
Diffstat (limited to 'src/database/sql/driver')
| -rw-r--r-- | src/database/sql/driver/driver.go | 32 | ||||
| -rw-r--r-- | src/database/sql/driver/types.go | 30 |
2 files changed, 32 insertions, 30 deletions
diff --git a/src/database/sql/driver/driver.go b/src/database/sql/driver/driver.go index 5342315d12..43fa579bda 100644 --- a/src/database/sql/driver/driver.go +++ b/src/database/sql/driver/driver.go @@ -47,12 +47,12 @@ import ( // It is either nil, a type handled by a database driver's NamedValueChecker // interface, or an instance of one of these types: // -// int64 -// float64 -// bool -// []byte -// string -// time.Time +// int64 +// float64 +// bool +// []byte +// string +// time.Time // // If the driver supports cursors, a returned Value may also implement the Rows interface // in this package. This is used, for example, when a user selects a cursor @@ -481,12 +481,13 @@ type RowsColumnTypeDatabaseTypeName interface { // not a variable length type ok should return false. // If length is not limited other than system limits, it should return math.MaxInt64. // The following are examples of returned values for various types: -// TEXT (math.MaxInt64, true) -// varchar(10) (10, true) -// nvarchar(10) (10, true) -// decimal (0, false) -// int (0, false) -// bytea(30) (30, true) +// +// TEXT (math.MaxInt64, true) +// varchar(10) (10, true) +// nvarchar(10) (10, true) +// decimal (0, false) +// int (0, false) +// bytea(30) (30, true) type RowsColumnTypeLength interface { Rows ColumnTypeLength(index int) (length int64, ok bool) @@ -504,9 +505,10 @@ type RowsColumnTypeNullable interface { // RowsColumnTypePrecisionScale may be implemented by Rows. It should return // the precision and scale for decimal types. If not applicable, ok should be false. // The following are examples of returned values for various types: -// decimal(38, 4) (38, 4, true) -// int (0, 0, false) -// decimal (math.MaxInt64, math.MaxInt64, true) +// +// decimal(38, 4) (38, 4, true) +// int (0, 0, false) +// decimal (math.MaxInt64, math.MaxInt64, true) type RowsColumnTypePrecisionScale interface { Rows ColumnTypePrecisionScale(index int) (precision, scale int64, ok bool) diff --git a/src/database/sql/driver/types.go b/src/database/sql/driver/types.go index 506ce6c2cd..fa98df7acd 100644 --- a/src/database/sql/driver/types.go +++ b/src/database/sql/driver/types.go @@ -17,16 +17,16 @@ import ( // driver package to provide consistent implementations of conversions // between drivers. The ValueConverters have several uses: // -// * converting from the Value types as provided by the sql package -// into a database table's specific column type and making sure it -// fits, such as making sure a particular int64 fits in a -// table's uint16 column. +// - converting from the Value types as provided by the sql package +// into a database table's specific column type and making sure it +// fits, such as making sure a particular int64 fits in a +// table's uint16 column. // -// * converting a value as given from the database into one of the -// driver Value types. +// - converting a value as given from the database into one of the +// driver Value types. // -// * by the sql package, for converting from a driver's Value type -// to a user's type in a scan. +// - by the sql package, for converting from a driver's Value type +// to a user's type in a scan. type ValueConverter interface { // ConvertValue converts a value to a driver Value. ConvertValue(v any) (Value, error) @@ -45,13 +45,13 @@ type Valuer interface { // Bool is a ValueConverter that converts input values to bools. // // The conversion rules are: -// - booleans are returned unchanged -// - for integer types, -// 1 is true -// 0 is false, -// other integers are an error -// - for strings and []byte, same rules as strconv.ParseBool -// - all other types are an error +// - booleans are returned unchanged +// - for integer types, +// 1 is true +// 0 is false, +// other integers are an error +// - for strings and []byte, same rules as strconv.ParseBool +// - all other types are an error var Bool boolType type boolType struct{} |
