Only show own accounts on home page
This commit is contained in:
parent
2c05140382
commit
924c7395cf
7 changed files with 106 additions and 79 deletions
12
db/orm.js
12
db/orm.js
|
@ -113,12 +113,18 @@ class From {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {Partial<U.Numberish<U.Models[Table]>>} conditions
|
||||
* @param {Partial<U.ValueOrArray<U.Numberish<U.Models[Table]>>>} conditions
|
||||
*/
|
||||
where(conditions) {
|
||||
|
||||
const wheres = Object.entries(conditions).map(([col, value]) => {
|
||||
this.parameters.push(value)
|
||||
return `"${col}" = ?`
|
||||
if (Array.isArray(value)) {
|
||||
this.parameters.push(...value)
|
||||
return `"${col}" IN (` + Array(value.length).fill("?").join(", ") + ")"
|
||||
} else {
|
||||
this.parameters.push(value)
|
||||
return `"${col}" = ?`
|
||||
}
|
||||
})
|
||||
this.sql += " WHERE " + wheres.join(" AND ")
|
||||
return this
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue