Remote / foldkit-remote-drizzle
Computed fields
The built-in computed field is a count over a collection relation:
ts
const Post = entity('Post', posts, {
relations: {
comments: many(Comment, {
foreignKey: comments.postId,
localKey: posts.id,
}),
},
computed: {
commentCount: { relation: 'comments' },
},
})commentCount becomes a Remote number field. The Source runs a grouped
count(*), including the relation's static where and principal policy. The
count is the total relation count, not the current page count.
Other aggregate shapes are intentionally not a generic compiler yet.