How do we infer the batch query, response??

const batchResponse: BatchResponse<
[
BatchItem<typeof schema.users.$inferSelect>,
BatchItem<typeof schema.newsletters.$inferSelect>,
BatchItem<typeof schema.guestBook.$inferSelect>,
BatchItem<typeof schema.bookmarks.$inferSelect>,
]
> = await db.batch([
db.select().from(schema.users),
db.select().from(schema.newsletters),
db.select().from(schema.guestBook),
db.select().from(schema.bookmarks),
]);
const batchResponse: BatchResponse<
[
BatchItem<typeof schema.users.$inferSelect>,
BatchItem<typeof schema.newsletters.$inferSelect>,
BatchItem<typeof schema.guestBook.$inferSelect>,
BatchItem<typeof schema.bookmarks.$inferSelect>,
]
> = await db.batch([
db.select().from(schema.users),
db.select().from(schema.newsletters),
db.select().from(schema.guestBook),
db.select().from(schema.bookmarks),
]);
2 Replies
rphlmr ⚡
rphlmr ⚡6mo ago
Maybe
import { RunnableQuery } from "drizzle-orm/runnable-query";

const batchResponse: BatchResponse<
[
RunnableQuery<Array<typeof schema.users.$inferSelect>, "sqlite">,
RunnableQuery<Array<typeof schema.newsletters.$inferSelect>, "sqlite">,
RunnableQuery<Array<typeof schema.guestBook.$inferSelect>, "sqlite">,
RunnableQuery<Array<typeof schema.bookmarks.$inferSelect>, "sqlite">,
]
> = await db.batch([
db.select().from(schema.users),
db.select().from(schema.newsletters),
db.select().from(schema.guestBook),
db.select().from(schema.bookmarks),
]);
import { RunnableQuery } from "drizzle-orm/runnable-query";

const batchResponse: BatchResponse<
[
RunnableQuery<Array<typeof schema.users.$inferSelect>, "sqlite">,
RunnableQuery<Array<typeof schema.newsletters.$inferSelect>, "sqlite">,
RunnableQuery<Array<typeof schema.guestBook.$inferSelect>, "sqlite">,
RunnableQuery<Array<typeof schema.bookmarks.$inferSelect>, "sqlite">,
]
> = await db.batch([
db.select().from(schema.users),
db.select().from(schema.newsletters),
db.select().from(schema.guestBook),
db.select().from(schema.bookmarks),
]);
Want results from more Discord servers?
Add your server