ยฉ 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Teamโ€ข3y agoโ€ข
1 reply
Frederic

[solved] Parameterized Column Selection

I would like have a function that makes a select(). This function takes a parameter that specify the columns that need to be retrieved. Obviously, I would like the proper type to be inferred for the result.

I could find the following code that works properly for Postgres.
example implementation Pg - ts playground

I made a 1:1 modification to make it work with MySql. Here is the modified code:

implementation converted to MySql

Unfortunately, the type
Awaited<MySqlSelectBase<any, P, "partial">>
Awaited<MySqlSelectBase<any, P, "partial">>
does not seem to work.
MySqlSelectBase
MySqlSelectBase
does not work exactly like
PgSelectBase
PgSelectBase
. A parameter seems to be missing.

I checked if the AI could unravel this problem without success.

If anybody knowledgeable about the inner working of drizzle knows how to solve this, this would be appreciated.
TS Playground - An online editor for exploring TypeScript and JavaS...
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.
TS Playground - An online editor for exploring TypeScript and JavaS...
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

[Solved] Aliasing a column
Drizzle TeamDTDrizzle Team / help
16mo ago
[SOLVED] How to add new column?
Drizzle TeamDTDrizzle Team / help
3y ago
parameterized insert and update
Drizzle TeamDTDrizzle Team / help
3y ago
Parameterized Interval in Where Clause
Drizzle TeamDTDrizzle Team / help
2y ago