Skip to content

Commit 53608c2

Browse files
committed
changed visibility of bulk upsert data types and interfaces
1 parent 3637f53 commit 53608c2

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

table/table.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -606,18 +606,18 @@ func (data bulkUpsertRows) ApplyBulkUpsertRequest(a *allocator.Allocator, req *B
606606
return nil
607607
}
608608

609-
func NewBulkUpsertRows(rows value.Value) bulkUpsertRows {
609+
func BulkUpsertDataRows(rows value.Value) bulkUpsertRows {
610610
return bulkUpsertRows{
611611
Rows: rows,
612612
}
613613
}
614614

615615
type bulkUpsertCsv struct {
616616
Data []byte
617-
Options []CsvFormatOption
617+
Options []csvFormatOption
618618
}
619619

620-
type CsvFormatOption interface {
620+
type csvFormatOption interface {
621621
ApplyCsvFormatOption(req *BulkUpsertRequest) (err error)
622622
}
623623

@@ -637,7 +637,7 @@ func (data bulkUpsertCsv) ApplyBulkUpsertRequest(a *allocator.Allocator, req *Bu
637637
return err
638638
}
639639

640-
func NewBulkUpsertCsv(data []byte, opts ...CsvFormatOption) bulkUpsertCsv {
640+
func BulkUpsertDataCsv(data []byte, opts ...csvFormatOption) bulkUpsertCsv {
641641
return bulkUpsertCsv{
642642
Data: data,
643643
Options: opts,
@@ -674,7 +674,7 @@ func (opt *csvHeaderOption) ApplyCsvFormatOption(req *BulkUpsertRequest) error {
674674
}
675675

676676
// First not skipped line is a CSV header (list of column names).
677-
func WithCsvHeader() CsvFormatOption {
677+
func WithCsvHeader() csvFormatOption {
678678
return &csvHeaderOption{}
679679
}
680680

@@ -689,7 +689,7 @@ func (opt *csvNullValueOption) ApplyCsvFormatOption(req *BulkUpsertRequest) erro
689689
}
690690

691691
// String value that would be interpreted as NULL.
692-
func WithCsvNullValue(value []byte) CsvFormatOption {
692+
func WithCsvNullValue(value []byte) csvFormatOption {
693693
return &csvNullValueOption{value}
694694
}
695695

@@ -704,7 +704,7 @@ func (opt *csvDelimiterOption) ApplyCsvFormatOption(req *BulkUpsertRequest) erro
704704
}
705705

706706
// Fields delimiter in CSV file. It's "," if not set.
707-
func WithCsvDelimiter(value []byte) CsvFormatOption {
707+
func WithCsvDelimiter(value []byte) csvFormatOption {
708708
return &csvDelimiterOption{value}
709709
}
710710

@@ -719,16 +719,16 @@ func (opt *csvSkipRowsOption) ApplyCsvFormatOption(req *BulkUpsertRequest) error
719719
}
720720

721721
// Number of rows to skip before CSV data. It should be present only in the first upsert of CSV file.
722-
func WithCsvSkipRows(count uint32) CsvFormatOption {
722+
func WithCsvSkipRows(count uint32) csvFormatOption {
723723
return &csvSkipRowsOption{count}
724724
}
725725

726726
type bulkUpsertArrow struct {
727727
Data []byte
728-
Options []ArrowFormatOption
728+
Options []arrowFormatOption
729729
}
730730

731-
type ArrowFormatOption interface {
731+
type arrowFormatOption interface {
732732
ApplyArrowFormatOption(req *BulkUpsertRequest) (err error)
733733
}
734734

@@ -748,7 +748,7 @@ func (data bulkUpsertArrow) ApplyBulkUpsertRequest(a *allocator.Allocator, req *
748748
return err
749749
}
750750

751-
func NewBulkUpsertArrow(data []byte, opts ...ArrowFormatOption) bulkUpsertArrow {
751+
func BulkUpsertDataArrow(data []byte, opts ...arrowFormatOption) bulkUpsertArrow {
752752
return bulkUpsertArrow{
753753
Data: data,
754754
Options: opts,
@@ -786,6 +786,6 @@ func (opt *arrowSchemaOption) ApplyArrowFormatOption(req *BulkUpsertRequest) err
786786
return nil
787787
}
788788

789-
func WithArrowSchema(schema []byte) ArrowFormatOption {
789+
func WithArrowSchema(schema []byte) arrowFormatOption {
790790
return &arrowSchemaOption{schema}
791791
}

tests/integration/table_bulk_upsert_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func TestTableBulkUpsert(t *testing.T) {
6464
))
6565
}
6666

67-
err := driver.Table().BulkUpsert(scope.Ctx, tablePath, table.NewBulkUpsertRows(
67+
err := driver.Table().BulkUpsert(scope.Ctx, tablePath, table.BulkUpsertDataRows(
6868
types.ListValue(rows...),
6969
))
7070
scope.Require.NoError(err)
@@ -86,7 +86,7 @@ func TestTableCsvBulkUpsert(t *testing.T) {
8686
42,"text42"
8787
43,"text43"`
8888

89-
err := driver.Table().BulkUpsert(scope.Ctx, tablePath, table.NewBulkUpsertCsv(
89+
err := driver.Table().BulkUpsert(scope.Ctx, tablePath, table.BulkUpsertDataCsv(
9090
[]byte(csv),
9191
table.WithCsvHeader(),
9292
))
@@ -107,7 +107,7 @@ func TestTableCsvBulkUpsertDelimiter(t *testing.T) {
107107
42:"text42"
108108
43:"text43"`
109109

110-
err := driver.Table().BulkUpsert(scope.Ctx, tablePath, table.NewBulkUpsertCsv(
110+
err := driver.Table().BulkUpsert(scope.Ctx, tablePath, table.BulkUpsertDataCsv(
111111
[]byte(csv),
112112
table.WithCsvHeader(),
113113
table.WithCsvDelimiter([]byte(":")),
@@ -129,7 +129,7 @@ func TestTableCsvBulkUpsertNullValue(t *testing.T) {
129129
42,hello
130130
43,hello world`
131131

132-
err := driver.Table().BulkUpsert(scope.Ctx, tablePath, table.NewBulkUpsertCsv(
132+
err := driver.Table().BulkUpsert(scope.Ctx, tablePath, table.BulkUpsertDataCsv(
133133
[]byte(csv),
134134
table.WithCsvHeader(),
135135
table.WithCsvNullValue([]byte("hello")),
@@ -157,7 +157,7 @@ id,val
157157
158158
`
159159

160-
err := driver.Table().BulkUpsert(scope.Ctx, tablePath, table.NewBulkUpsertCsv(
160+
err := driver.Table().BulkUpsert(scope.Ctx, tablePath, table.BulkUpsertDataCsv(
161161
[]byte(csv),
162162
table.WithCsvHeader(),
163163
table.WithCsvSkipRows(2),
@@ -182,7 +182,7 @@ func TestTableArrowBulkUpsert(t *testing.T) {
182182
schema, err := os.ReadFile("testdata/bulk_upsert_test_schema.arrow")
183183
scope.Require.NoError(err)
184184

185-
err = driver.Table().BulkUpsert(scope.Ctx, tablePath, table.NewBulkUpsertArrow(
185+
err = driver.Table().BulkUpsert(scope.Ctx, tablePath, table.BulkUpsertDataArrow(
186186
[]byte(data),
187187
table.WithArrowSchema(schema),
188188
))

0 commit comments

Comments
 (0)