Add database/sql support to pgtype
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package pgtype
|
||||
|
||||
import "database/sql/driver"
|
||||
|
||||
// Unknown represents the PostgreSQL unknown type. It is either a string literal
|
||||
// or NULL. It is used when PostgreSQL does not know the type of a value. In
|
||||
// general, this will only be used in pgx when selecting a null value without
|
||||
@@ -30,3 +32,13 @@ func (dst *Unknown) DecodeText(ci *ConnInfo, src []byte) error {
|
||||
func (dst *Unknown) DecodeBinary(ci *ConnInfo, src []byte) error {
|
||||
return (*Text)(dst).DecodeBinary(ci, src)
|
||||
}
|
||||
|
||||
// Scan implements the database/sql Scanner interface.
|
||||
func (dst *Unknown) Scan(src interface{}) error {
|
||||
return (*Text)(dst).Scan(src)
|
||||
}
|
||||
|
||||
// Value implements the database/sql/driver Valuer interface.
|
||||
func (src Unknown) Value() (driver.Value, error) {
|
||||
return (Text)(src).Value()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user