Closed k-anshul closed 9 months ago
Great addition, thanks @k-anshul. I've refactored the tests a little bit. Could you please provide a reference or documentation link for further understanding of the following part?
internalType := C.duckdb_enum_internal_type(ty)
switch internalType {
case C.DUCKDB_TYPE_UTINYINT:
idx = uint64(get[uint8](vector, rowIdx))
case C.DUCKDB_TYPE_USMALLINT:
idx = uint64(get[uint16](vector, rowIdx))
case C.DUCKDB_TYPE_UINTEGER:
idx = uint64(get[uint32](vector, rowIdx))
case C.DUCKDB_TYPE_UBIGINT:
idx = get[uint64](vector, rowIdx)
default:
return "", errInvalidType
}
This PR adds ability to scan duckDB enum types as strings by default:
import ( "context" "database/sql" "fmt" "log"
)
// Define a custom type for the enum type Status string
const ( Pending Status = "pending" Approved Status = "approved" Rejected Status = "rejected" )
func main() {
}