ricin
ricin
DTDrizzle Team
Created by ricin on 9/19/2023 in #help
Using one function to query many tables of same structure
Hello i have many tables (5-6) that have same structure like this
export const speciality = pgTable('speciality', {
id: serial('id').primaryKey(),
name: varchar('name', { length: 255 }).notNull()
});
export const speciality = pgTable('speciality', {
id: serial('id').primaryKey(),
name: varchar('name', { length: 255 }).notNull()
});
this is what i think is called lookup table, i want a simple query that fetches from one of the tables (based on function arg) and gives out a a simple result, query is simple, no joins or anything, just a limit, is there a way to create a function that does this in a typesafe manner
8 replies