Eli
Eli
DTDrizzle Team
Created by Eli on 6/21/2024 in #help
All values of query result are of type string
As stated in https://orm.drizzle.team/docs/sql#sqlt - there is no way to get the result-typed other than strings?
2 replies
DTDrizzle Team
Created by Eli on 5/25/2024 in #help
Get return-type from QueryBuilder
4 replies
DTDrizzle Team
Created by Eli on 5/25/2024 in #help
Get return-type from QueryBuilder
I managed to get a hacky solution, I would be able to infer the types, such that the caller-side has no types explicitly stated
export async function MockRequest
<T extends MySqlSelectQueryBuilder,R>
( qb: T )
: Promise<R[]>
{
const untypedData = {} // get data from somewhere else..
const data = untypedData as R[]

return data
}

// Ugly call:
const players = ( await MockRequest
<
ReturnType<typeof playerQuery.$dynamic>,
typeof playerQuery._.result
>
( playerQuery.$dynamic() )
)
export async function MockRequest
<T extends MySqlSelectQueryBuilder,R>
( qb: T )
: Promise<R[]>
{
const untypedData = {} // get data from somewhere else..
const data = untypedData as R[]

return data
}

// Ugly call:
const players = ( await MockRequest
<
ReturnType<typeof playerQuery.$dynamic>,
typeof playerQuery._.result
>
( playerQuery.$dynamic() )
)
4 replies
DTDrizzle Team
Created by Eli on 5/25/2024 in #help
Get return-type from QueryBuilder
After digging through alot of issues, i fund this: https://github.com/drizzle-team/drizzle-orm/pull/1662 So it seems not possible (yet?)
4 replies
DTDrizzle Team
Created by Eli on 5/23/2024 in #help
Get raw SQL string with parameters
Alright, thank you very much 🙂
3 replies
DTDrizzle Team
Created by dev0 on 5/17/2024 in #help
Effectively mixing QueryBuilder and sql`` using CTEs
Did you replaces all the escapeParam (like questionmarks ? in the getSQL().sql) yourself to get the raw SQL string?
5 replies
DTDrizzle Team
Created by et on 2/9/2024 in #help
Is it possible to use Drizzle with MySQL without a connection? I just want to generate SQL strings.
for others that might see this (or find the link from google) there is const qb = new QueryBuilder() which can be used I guess
3 replies