pgx/varchar.go
Jack Christensen 6e21cb00fe Add pgtype.Record and prerequisite restructuring
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.
2017-03-18 12:01:16 -05:00

41 lines
1.0 KiB
Go

package pgtype
import (
"io"
)
type Varchar Text
// Set converts from src to dst. Note that as Varchar is not a general
// number type Set does not do automatic type conversion as other number
// types do.
func (dst *Varchar) Set(src interface{}) error {
return (*Text)(dst).Set(src)
}
func (dst *Varchar) Get() interface{} {
return (*Text)(dst).Get()
}
// AssignTo assigns from src to dst. Note that as Varchar is not a general number
// type AssignTo does not do automatic type conversion as other number types do.
func (src *Varchar) AssignTo(dst interface{}) error {
return (*Text)(src).AssignTo(dst)
}
func (dst *Varchar) DecodeText(ci *ConnInfo, src []byte) error {
return (*Text)(dst).DecodeText(ci, src)
}
func (dst *Varchar) DecodeBinary(ci *ConnInfo, src []byte) error {
return (*Text)(dst).DecodeBinary(ci, src)
}
func (src Varchar) EncodeText(ci *ConnInfo, w io.Writer) (bool, error) {
return (Text)(src).EncodeText(ci, w)
}
func (src Varchar) EncodeBinary(ci *ConnInfo, w io.Writer) (bool, error) {
return (Text)(src).EncodeBinary(ci, w)
}