drizzle-orm
drizzle-orm copied to clipboard
feat(orm): allow customType selectFromDb SQL transforms
Addresses drizzle-team/drizzle-orm#1083.
Summary
This PR adds a new optional selectFromDb hook to customType(...), allowing custom columns to customize how they are selected from the database before driver decoding.
This is useful for custom types that require SQL-level transformation when selected, such as PostGIS geometries.
Changes
- Adds
selectFromDbto custom type params across supported dialects. - Uses
selectFromDbduring select query generation. - Adds a test covering custom select SQL generation.
- Updates custom type documentation.
Verification
Ran:
npx -y [email protected] -C drizzle-orm test -- --run customTypeSelectFromDb