9 lines
445 B
JavaScript
9 lines
445 B
JavaScript
export default class QueryBuilder {
|
|
constructor(){ this.query={}; }
|
|
fromJSON(q){ this.query=q; return this; }
|
|
select(cfg){ this.query={ op:'SELECT', ...cfg }; return this; }
|
|
insert(cfg){ this.query={ op:'INSERT', ...cfg }; return this; }
|
|
update(cfg){ this.query={ op:'UPDATE', ...cfg }; return this; }
|
|
delete(cfg){ this.query={ op:'DELETE', ...cfg }; return this; }
|
|
async execute(dbClient){ return dbClient.execute(this.query); }
|
|
} |