Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
EdamAme-x authored Nov 16, 2023
1 parent 02d8c4e commit 147db54
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,18 @@ export class TakoKV {
}

insertRow(tableName: string, rowId: number, row: {
[key: string]: any
}): boolean {

// push row [row, row, {}, row] <= INSERT ROW

for (const key of Object.keys(row)) {
this.current[tableName][key] = this._shiftArray(this.current[tableName][key], rowId);
this.current[tableName][key][rowId] = row[key]; // INSERT
}

this._IDgen(tableName, this.current[tableName][Object.keys(row)[0]].length);
[key: string]: any
}): boolean {
for (const key of Object.keys(row)) {
if (!this.current[tableName][key]) {
this.current[tableName][key] = Array(rowId).fill(undefined); // 追加
}
this.current[tableName][key].splice(rowId, 0, row[key]); // 追加
}

return true;
this._IDgen(tableName, this.current[tableName][Object.keys(row)[0]].length);

return true;
}

getRows(tableName: string): number {
Expand Down Expand Up @@ -131,7 +130,7 @@ export class TakoKV {
}
array[array.length - 1] = undefined; // empty (will insert)
return array;
}
} // subset

_removeAndShift(arr: any[], index: number): any[] {
arr.splice(index, 1);
Expand Down

0 comments on commit 147db54

Please sign in to comment.