Skip to content

Commit

Permalink
remove helper after feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
taniabogatsch committed Jun 18, 2024
1 parent ac14a34 commit e182f7d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 29 deletions.
17 changes: 17 additions & 0 deletions appender.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,20 @@ func (a *Appender) closeDataChunks() {
}
a.chunks = a.chunks[:0]
}

func mallocTypeSlice(count int) (unsafe.Pointer, []C.duckdb_logical_type) {
var dummy C.duckdb_logical_type
size := C.size_t(unsafe.Sizeof(dummy))

ptr := unsafe.Pointer(C.malloc(C.size_t(count) * size))
slice := (*[1 << 30]C.duckdb_logical_type)(ptr)[:count:count]

return ptr, slice
}

func destroyTypeSlice(ptr unsafe.Pointer, slice []C.duckdb_logical_type) {
for _, t := range slice {
C.duckdb_destroy_logical_type(&t)
}
C.free(ptr)
}
29 changes: 0 additions & 29 deletions helper.go

This file was deleted.

3 changes: 3 additions & 0 deletions vector_setters.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import (
"unsafe"
)

// secondsPerDay to calculate the days since 1970-01-01.
const secondsPerDay = 24 * 60 * 60

// fnSetVectorValue is the setter callback function for any (nested) vector.
type fnSetVectorValue func(vec *vector, rowIdx C.idx_t, val any)

Expand Down

0 comments on commit e182f7d

Please sign in to comment.