Eli
DTDrizzle Team
•Created by Eli on 6/21/2024 in #help
All values of query result are of type string
I I use Drizzle as query builder
Output:
The intellisense in VSCode shows me the correct types on hover (as specified in the sql template strings)
However the actual data in
result
is all string
I know it is a bit of a hacky solution, as I use Drizzle to generate a raw SQL query with typings applied later on.
Since there is currently no other way of getting the types otherwise () am I doing something wrong here that I do not get the types right
(anylinger - it seemed to work up until now or I haven't checked it thorough)2 replies
DTDrizzle Team
•Created by Eli on 5/25/2024 in #help
Get return-type from QueryBuilder
I do not have a connection to a DB, I just use the query-builder for SQL generation.
I try to write a simple function, that takes a querybuilder query in and should return a object of the result type, as if I have awaited a DB with the query:
(I use another db to fetch data - but I need the type from drizzle) This is the return-type:
When it should be:
How do I type this correctly?
I try to write a simple function, that takes a querybuilder query in and should return a object of the result type, as if I have awaited a DB with the query:
(I use another db to fetch data - but I need the type from drizzle) This is the return-type:
When it should be:
How do I type this correctly?
4 replies
DTDrizzle Team
•Created by Eli on 5/23/2024 in #help
Get raw SQL string with parameters
I use drizzle to build up SQL strings - but I need to get the final SQL string.
I can use
query.toSQL()
and then do a string-replace on ?
with toSQL().sql | toSQL().params
.
My questions are:
- is this the right way to do it?
- if so, is it safe to do a simple text-replace on the question-marks?3 replies