Skip to content

Commit

Permalink
delete with no condition
Browse files Browse the repository at this point in the history
  • Loading branch information
budiadiono committed Oct 16, 2018
1 parent 2a08047 commit 59062cf
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,13 @@ export class Table<M, T extends TableClass<M>> {
return this.exec(sql)
}

delete(condition: ConditionCallbackPure<M>) {
return this.exec(
`DELETE FROM ${Utils.quote(this.name)} WHERE ${this._condSql(condition)}`
)
delete(condition?: ConditionCallbackPure<M>) {
const sql = condition
? `DELETE FROM ${Utils.quote(this.name)} WHERE ${this._condSql(
condition
)}`
: `DELETE FROM ${Utils.quote(this.name)}`
return this.exec(sql)
}

private _selectSql(
Expand Down

0 comments on commit 59062cf

Please sign in to comment.