2020-01-30 16:14:25 +02:00
|
|
|
import { Run } from "./run";
|
|
|
|
|
2022-12-13 06:33:48 +02:00
|
|
|
import * as wasm from "./pkg";
|
|
|
|
|
2020-01-30 16:14:25 +02:00
|
|
|
export class Insert {
|
|
|
|
run: Run;
|
|
|
|
_author: string | null = null;
|
|
|
|
_date: string | null = null;
|
|
|
|
constructor(run: Run) {
|
|
|
|
this.run = run;
|
|
|
|
}
|
|
|
|
|
|
|
|
author(author: string) {
|
|
|
|
this._author = author;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
date(date: string) {
|
|
|
|
this._date = date;
|
|
|
|
return this;
|
|
|
|
}
|
2022-12-13 06:33:48 +02:00
|
|
|
|
|
|
|
build() {
|
|
|
|
const run = this.run.build();
|
|
|
|
let insert = wasm.createInsert(run);
|
|
|
|
if (this._author) {
|
|
|
|
insert = insert.author(this._author);
|
|
|
|
}
|
|
|
|
if (this._date) {
|
|
|
|
insert = insert.date(this._date);
|
|
|
|
}
|
|
|
|
return insert;
|
|
|
|
}
|
2020-01-30 16:14:25 +02:00
|
|
|
}
|