Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: fix linter warnings #231

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions appender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,9 +527,10 @@ func TestAppenderNullStruct(t *testing.T) {
for res.Next() {
var row any
err = res.Scan(&row)
if i == 0 {
switch i {
case 0:
require.NoError(t, err)
} else if i == 1 {
case 1:
require.Equal(t, nil, row)
}
i++
Expand Down
5 changes: 3 additions & 2 deletions appender_vector.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,10 @@ func (vec *vector) setCString(rowIdx C.idx_t, val any) {
}

var str string
if vec.duckdbType == C.DUCKDB_TYPE_VARCHAR {
switch vec.duckdbType {
case C.DUCKDB_TYPE_VARCHAR:
str = val.(string)
} else if vec.duckdbType == C.DUCKDB_TYPE_BLOB {
case C.DUCKDB_TYPE_BLOB:
str = string(val.([]byte)[:])
}

Expand Down
4 changes: 2 additions & 2 deletions rows.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func scan(vector C.duckdb_vector, rowIdx C.idx_t) (any, error) {
case C.DUCKDB_TYPE_STRUCT:
return scanStruct(columnType, vector, rowIdx)
case C.DUCKDB_TYPE_MAP:
return scanMap(columnType, vector, rowIdx)
return scanMap(vector, rowIdx)
case C.DUCKDB_TYPE_UUID:
hugeInt := get[C.duckdb_hugeint](vector, rowIdx)
return hugeIntToUUID(hugeInt), nil
Expand Down Expand Up @@ -289,7 +289,7 @@ func get[T any](vector C.duckdb_vector, rowIdx C.idx_t) T {
return xs[rowIdx]
}

func scanMap(ty C.duckdb_logical_type, vector C.duckdb_vector, rowIdx C.idx_t) (Map, error) {
func scanMap(vector C.duckdb_vector, rowIdx C.idx_t) (Map, error) {
list, err := scanList(vector, rowIdx)
if err != nil {
return nil, err
Expand Down
Loading