2
0

Add pgtype GenericText and GenericBinary

Rows.Values uses this for unknown types.
This commit is contained in:
Jack Christensen
2017-03-11 20:28:14 -06:00
parent aac8fd66f2
commit 3391818847
3 changed files with 60 additions and 7 deletions
+29
View File
@@ -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)
}