我的代码:
const allPosts = await db.query.Posts.findMany({
where: {
data: inArray(....)
}
});
报错:
对象字面量只能指定已知属性,并且“data”不在类型“SQL<unknown> | ((fields: { id: PgColumn<{ name: "id"; tableName: "posts"; dataType: "number"; columnType: "PgInteger"; data: number; driverParam: string | number; notNull: true; hasDefault: true; isPrimaryKey: true; ... 5 more ...; generated: undefined; }, {}, {}>; ... 10 more ...; updatedAt: PgColumn<...>; }, oper...”中。ts(2353)
我的预期:
查询这个字段的值有没有在数组 a 里
临时解决办法,换成 Select 查询:
await db.select()
.from(Posts)
.where(
inArray(Posts.name, posts)
)
|