Node.js Drizzle 查询表结构返回的类型
Drizzle Node.js About 298 words$inferSelect
使用typeof
、$inferSelect
提取表结构的类型。
const posts = pgTable("post", {
id: integer().primaryKey(),
title: text(),
});
export type Post = typeof posts.$inferSelect;
查询 API
const postList: Array<Post> = await db.select()
.from(posts)
.where(eq(posts.id, postId))
.limit(1);
Views: 10 · Posted: 2025-10-09
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓

Loading...