Skip to content

Commit

Permalink
[AB#1669514] structured read test
Browse files Browse the repository at this point in the history
  • Loading branch information
ChronosMasterOfAllTime committed Nov 19, 2024
1 parent 76b1e12 commit c3e9be6
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions structured_type_read_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import (
"database/sql"
"database/sql/driver"
"fmt"
"github.com/apache/arrow/go/v15/arrow"
"github.com/apache/arrow/go/v15/arrow/array"
"github.com/apache/arrow/go/v15/arrow/memory"
"math/big"
"reflect"
"strings"
"testing"
"time"

"github.com/apache/arrow/go/v15/arrow"
"github.com/apache/arrow/go/v15/arrow/array"
"github.com/apache/arrow/go/v15/arrow/memory"
)

type objectWithAllTypes struct {
Expand All @@ -35,6 +36,7 @@ type objectWithAllTypes struct {
sArr []string
f64Arr []float64
someMap map[string]bool
uuid UUID
}

func (o *objectWithAllTypes) Scan(val any) error {
Expand Down Expand Up @@ -111,6 +113,13 @@ func (o *objectWithAllTypes) Scan(val any) error {
if someMap != nil {
o.someMap = someMap.(map[string]bool)
}
uuidBytes, err := st.GetBytes("uuid")
if err != nil {
return err
}

o.uuid = UUID(uuidBytes)

return nil
}

Expand Down Expand Up @@ -172,6 +181,9 @@ func (o objectWithAllTypes) Write(sowc StructuredObjectWriterContext) error {
if err := sowc.WriteRaw("someMap", o.someMap); err != nil {
return err
}
if err := sowc.WriteBytes("uuid", o.uuid[:]); err != nil {
return err
}
return nil
}

Expand Down

0 comments on commit c3e9be6

Please sign in to comment.