Skip to content

Add selectFromDb hook for custom types#5753

Open
partyplatter08-lab wants to merge 1 commit into
drizzle-team:mainfrom
partyplatter08-lab:partyplatter08-lab/bounty-1083
Open

Add selectFromDb hook for custom types#5753
partyplatter08-lab wants to merge 1 commit into
drizzle-team:mainfrom
partyplatter08-lab:partyplatter08-lab/bounty-1083

Conversation

@partyplatter08-lab
Copy link
Copy Markdown

Summary

  • add an optional selectFromDb(column, decoder, columnName) hook to customType() for PostgreSQL, MySQL, SQLite, SingleStore, and Gel custom columns
  • route selected columns through the hook in normal selects, returning selections, and relational query JSON selections while preserving the existing fromDriver decoder path
  • document the hook and add focused SQL-generation/decoder coverage across dialects, including relational query columns

Validation

  • corepack pnpm install --frozen-lockfile
  • corepack pnpm --filter drizzle-orm exec vitest run tests/custom-select-from-db.test.ts
  • corepack pnpm exec dprint check docs/custom-types.lite.md drizzle-orm/src/column.ts drizzle-orm/src/utils.ts drizzle-orm/src/pg-core/columns/custom.ts drizzle-orm/src/mysql-core/columns/custom.ts drizzle-orm/src/sqlite-core/columns/custom.ts drizzle-orm/src/singlestore-core/columns/custom.ts drizzle-orm/src/gel-core/columns/custom.ts drizzle-orm/src/pg-core/dialect.ts drizzle-orm/src/mysql-core/dialect.ts drizzle-orm/src/sqlite-core/dialect.ts drizzle-orm/src/singlestore-core/dialect.ts drizzle-orm/src/gel-core/dialect.ts drizzle-orm/tests/custom-select-from-db.test.ts
  • corepack pnpm --filter drizzle-orm exec tsc -p tests/tsconfig.json --noEmit
  • corepack pnpm --filter drizzle-orm test
  • corepack pnpm --filter drizzle-orm test:types
  • PATH=/tmp/corepack-bin:$PATH corepack pnpm --filter drizzle-orm build

/claim #1083

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