[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">> does not seem to work. MySqlSelectBase does not work exactly like 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.
1 Reply
Frederic
FredericOP12mo ago
The answer is given by @Angelelz in the following github issue. For those interested, I have posted a slight variation that works in an Effect-ts context Thanks to @Angelelz
GitHub
[FEATURE]: Ability to specify selected fields dynamically · Issue #...
Describe what you want I have a model on my project that fetching users from the database. Each time I need different set of fields and I would like to define a function with generics so only the e...
Want results from more Discord servers?
Add your server