Skip to content

feat: add comprehensive type conversion methods to Value struct #575

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

Closed
wants to merge 1 commit into from

Conversation

redraiment
Copy link

Add missing type conversion methods to complement the existing to_int64() method, providing complete coverage for all DuckDB data types:

  • Integer types: to_int8, to_uint8, to_int16, to_uint16, to_int32, to_uint32, to_uint64
  • Large integer types: to_hugeint, to_uhugeint, to_varint
  • Numeric types: to_decimal, to_float, to_double
  • Temporal types: to_date, to_time, to_time_tz, to_timestamp, to_timestamp_tz, to_timestamp_s, to_timestamp_ms, to_timestamp_ns, to_interval
  • Other types: to_bool, to_varchar, to_blob, to_bit, to_uuid
  • Complex types: to_list, to_map_entries, to_struct_properties
  • Utility methods: value_type

All methods follow the same unsafe pattern as the original to_int64() implementation, directly wrapping the corresponding duckdb_get_* C API calls.

This enhancement provides a complete and consistent API for extracting values from DuckDB result sets in Rust applications.

Add missing type conversion methods to complement the existing to_int64()
method, providing complete coverage for all DuckDB data types:

- Integer types: to_int8, to_uint8, to_int16, to_uint16, to_int32, to_uint32, to_uint64
- Large integer types: to_hugeint, to_uhugeint, to_varint
- Numeric types: to_decimal, to_float, to_double
- Temporal types: to_date, to_time, to_time_tz, to_timestamp, to_timestamp_tz,
  to_timestamp_s, to_timestamp_ms, to_timestamp_ns, to_interval
- Other types: to_bool, to_varchar, to_blob, to_bit, to_uuid
- Complex types: to_list, to_map_entries, to_struct_properties
- Utility methods: value_type

All methods follow the same unsafe pattern as the original to_int64()
implementation, directly wrapping the corresponding duckdb_get_* C API calls.

This enhancement provides a complete and consistent API for extracting
values from DuckDB result sets in Rust applications.
@redraiment redraiment closed this Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant