mirror of
https://github.com/jackc/pgx.git
synced 2025-05-05 06:59:53 +00:00
Because reading a record type requires the decoder to be able to look up oid to type mapping and types such as hstore have types that are not fixed between different PostgreSQL servers it was necessary to restructure the pgtype system so all encoders and decodes take a *ConnInfo that includes oid/name/type information.
33 lines
974 B
Go
33 lines
974 B
Go
package pgtype
|
|
|
|
// 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
|
|
// type information. e.g. SELECT NULL;
|
|
type Unknown struct {
|
|
String string
|
|
Status Status
|
|
}
|
|
|
|
func (dst *Unknown) Set(src interface{}) error {
|
|
return (*Text)(dst).Set(src)
|
|
}
|
|
|
|
func (dst *Unknown) Get() interface{} {
|
|
return (*Text)(dst).Get()
|
|
}
|
|
|
|
// AssignTo assigns from src to dst. Note that as Unknown is not a general number
|
|
// type AssignTo does not do automatic type conversion as other number types do.
|
|
func (src *Unknown) AssignTo(dst interface{}) error {
|
|
return (*Text)(src).AssignTo(dst)
|
|
}
|
|
|
|
func (dst *Unknown) DecodeText(ci *ConnInfo, src []byte) error {
|
|
return (*Text)(dst).DecodeText(ci, src)
|
|
}
|
|
|
|
func (dst *Unknown) DecodeBinary(ci *ConnInfo, src []byte) error {
|
|
return (*Text)(dst).DecodeBinary(ci, src)
|
|
}
|