From 5a5268083af55a5afd68a53558b628831a311680 Mon Sep 17 00:00:00 2001 From: Gary Feng Date: Wed, 24 Apr 2024 11:43:28 -0400 Subject: [PATCH] support Geography values as WKT strings --- trino/trino.go | 2 +- trino/trino_test.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/trino/trino.go b/trino/trino.go index 1ae20f1..e16bdb8 100644 --- a/trino/trino.go +++ b/trino/trino.go @@ -1469,7 +1469,7 @@ func (c *typeConverter) ConvertValue(v interface{}) (driver.Value, error) { return nil, err } return vv.Bool, err - case "json", "char", "varchar", "varbinary", "interval year to month", "interval day to second", "decimal", "ipaddress", "uuid", "unknown": + case "json", "char", "varchar", "varbinary", "interval year to month", "interval day to second", "decimal", "ipaddress", "uuid", "SphericalGeography", "unknown": vv, err := scanNullString(v) if !vv.Valid { return nil, err diff --git a/trino/trino_test.go b/trino/trino_test.go index c79b1d9..31b9d99 100644 --- a/trino/trino_test.go +++ b/trino/trino_test.go @@ -1419,6 +1419,12 @@ func TestTypeConversion(t *testing.T) { []interface{}{"b"}, }, }, + { + DataType: "SphericalGeography", + RawType: "SphericalGeography", + ResponseUnmarshalledSample: "Point (0 0)", + ExpectedGoValue: "Point (0 0)", + }, } for _, tc := range testcases {