ricin
ricin
DTDrizzle Team
Created by pablo on 9/21/2023 in #help
Does Drizzle support Microsoft SQL Server?
3 replies
DTDrizzle Team
Created by ricin on 9/19/2023 in #help
Using one function to query many tables of same structure
that didn't work but i did this instead
type ReferenceTable = typeof speciality | typeof domain | /* all other tables */;

export async function searchInReference
(t: ReferenceTable, query: string)
type ReferenceTable = typeof speciality | typeof domain | /* all other tables */;

export async function searchInReference
(t: ReferenceTable, query: string)
this works for my use-case for now
8 replies
DTDrizzle Team
Created by ricin on 9/19/2023 in #help
Using one function to query many tables of same structure
i have 4-5 tables that share the same columns 'id serial' and 'name varchar', i want to use one function to for example : -search one of the tables for a string - maybe insert to one of the tables a string (id is auto incremented) without repeating the same function 4-5 times, while maintaining type safety
8 replies
DTDrizzle Team
Created by ricin on 9/19/2023 in #help
Using one function to query many tables of same structure
example query
async function searchInReference<T extends ?>(query : string) {
return await db.select()
.from(?)
.where(eq(T.name, query))
.limit(25)
}
async function searchInReference<T extends ?>(query : string) {
return await db.select()
.from(?)
.where(eq(T.name, query))
.limit(25)
}
8 replies