-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
This idea was suggested by Discord user @josefchi.
Essentially, it accepts the same value that db.query#findMany's where option does. But instead of executing a query, it returns a SQL instance, which you can use with db.select() calls, db.update() calls, etc.
Internally, it would call relationsFilterToSQL. Its main purpose is to provide type safety and auto-completion.
const where = db.query.user.$where({
age: { gte: 18 },
})
// => [object SQL]
where.toSQL()
// => {
// sql: `"user"."age" >= ?`,
// params: [18],
// }Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed