[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
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.
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.
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.