diff --git a/generic_binary.go b/generic_binary.go new file mode 100644 index 00000000..ac35ea60 --- /dev/null +++ b/generic_binary.go @@ -0,0 +1,29 @@ +package pgtype + +import ( + "io" +) + +// GenericBinary is a placeholder for binary format values that no other type exists +// to handle. +type GenericBinary Bytea + +func (dst *GenericBinary) Set(src interface{}) error { + return (*Bytea)(dst).Set(src) +} + +func (dst *GenericBinary) Get() interface{} { + return (*Bytea)(dst).Get() +} + +func (src *GenericBinary) AssignTo(dst interface{}) error { + return (*Bytea)(src).AssignTo(dst) +} + +func (dst *GenericBinary) DecodeBinary(src []byte) error { + return (*Bytea)(dst).DecodeBinary(src) +} + +func (src GenericBinary) EncodeBinary(w io.Writer) (bool, error) { + return (Bytea)(src).EncodeBinary(w) +} diff --git a/generic_text.go b/generic_text.go new file mode 100644 index 00000000..19f41059 --- /dev/null +++ b/generic_text.go @@ -0,0 +1,29 @@ +package pgtype + +import ( + "io" +) + +// GenericText is a placeholder for text format values that no other type exists +// to handle. +type GenericText Text + +func (dst *GenericText) Set(src interface{}) error { + return (*Text)(dst).Set(src) +} + +func (dst *GenericText) Get() interface{} { + return (*Text)(dst).Get() +} + +func (src *GenericText) AssignTo(dst interface{}) error { + return (*Text)(src).AssignTo(dst) +} + +func (dst *GenericText) DecodeText(src []byte) error { + return (*Text)(dst).DecodeText(src) +} + +func (src GenericText) EncodeText(w io.Writer) (bool, error) { + return (Text)(src).EncodeText(w) +}