Allow Bytea literal constructor to accept byte array.

Bytea literal constructor now accepts string or []byte a a parameter.
This commit is contained in:
go-jet 2021-05-12 12:29:22 +02:00
parent f30cbb9e89
commit 9385f462df
3 changed files with 66 additions and 4 deletions

View file

@ -62,6 +62,11 @@ func TestString(t *testing.T) {
assertSerialize(t, String("Some text"), `$1`, "Some text")
}
func TestBytea(t *testing.T) {
assertSerialize(t, Bytea("Some text"), `$1::bytea`, "Some text")
assertSerialize(t, Bytea([]byte("Some byte array")), `$1::bytea`, []byte("Some byte array"))
}
func TestDate(t *testing.T) {
assertSerialize(t, Date(2014, time.January, 2), `$1::date`, "2014-01-02")
assertSerialize(t, DateT(time.Now()), `$1::date`)