From 5eff91492c3408bb19928d95604d25cfc8871cb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Sun, 13 Oct 2024 05:36:54 +0000 Subject: [PATCH] test: cases couple fixes needed to get Array(Nullable(...)) & Nullable(DateTime64(...)) cases to work --- proto/col_auto_test.go | 2 ++ proto/col_datetime64.go | 4 ++++ proto/col_nullable.go | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/proto/col_auto_test.go b/proto/col_auto_test.go index a889fd11..dd8e46cc 100644 --- a/proto/col_auto_test.go +++ b/proto/col_auto_test.go @@ -46,6 +46,8 @@ func TestColAuto_Infer(t *testing.T) { ColumnTypeUUID, ColumnTypeArray.Sub(ColumnTypeUUID), ColumnTypeNullable.Sub(ColumnTypeUUID), + "Array(Nullable(Int8))", + "Nullable(DateTime64(3))", } { r := AutoResult("foo") require.NoError(t, r.Data.(Inferable).Infer(columnType)) diff --git a/proto/col_datetime64.go b/proto/col_datetime64.go index f4d96a49..1f93a0c4 100644 --- a/proto/col_datetime64.go +++ b/proto/col_datetime64.go @@ -126,6 +126,10 @@ func (c ColDateTime64) Raw() *ColDateTime64Raw { return &ColDateTime64Raw{ColDateTime64: c} } +func (c *ColDateTime64) Nullable() *ColNullable[time.Time] { + return &ColNullable[time.Time]{Values: c} +} + func (c *ColDateTime64) Array() *ColArr[time.Time] { return &ColArr[time.Time]{Data: c} } diff --git a/proto/col_nullable.go b/proto/col_nullable.go index dfac8fa2..fd3615d2 100644 --- a/proto/col_nullable.go +++ b/proto/col_nullable.go @@ -117,6 +117,12 @@ func (c ColNullable[T]) Row(i int) Nullable[T] { } } +func (c *ColNullable[T]) Array() *ColArr[Nullable[T]] { + return &ColArr[Nullable[T]]{ + Data: c, + } +} + func (c *ColNullable[T]) Reset() { c.Nulls.Reset() c.Values.Reset()