1.2.0
This commit is contained in:
parent
20ac2da081
commit
59de642d31
6 changed files with 3 additions and 85 deletions
10
src/index.ts
10
src/index.ts
|
@ -1,13 +1,5 @@
|
|||
import type { Column, ColumnShorthand, DataType } from "./columns";
|
||||
import { WrappedRow } from "./wrapped-row";
|
||||
import { Prequel } from "./prequel";
|
||||
import { Table } from "./table";
|
||||
|
||||
export {
|
||||
Prequel,
|
||||
Table,
|
||||
WrappedRow,
|
||||
type DataType,
|
||||
type Column,
|
||||
type ColumnShorthand,
|
||||
};
|
||||
export { Prequel, Table, type DataType, type Column, type ColumnShorthand };
|
||||
|
|
|
@ -7,7 +7,6 @@ import {
|
|||
} from "./columns";
|
||||
import { SchemaError } from "./error";
|
||||
import { Prequel } from "./prequel";
|
||||
import type { WrappedRow } from "./wrapped-row";
|
||||
|
||||
export type ExtractRowShape<T> = T extends Table<infer R> ? R : never;
|
||||
|
||||
|
@ -499,11 +498,6 @@ export class Table<RowShape> {
|
|||
return res.count;
|
||||
}
|
||||
|
||||
public save(wrapped: WrappedRow<RowShape>) {
|
||||
const row = wrapped.unwrap();
|
||||
this.update(row);
|
||||
}
|
||||
|
||||
public toString() {
|
||||
return `"${this._name}"`;
|
||||
}
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
/**
|
||||
* Represents an instance of a row in a table of a database.
|
||||
* Wraps the raw Row data and provides methods for interacting with it.
|
||||
*/
|
||||
export class WrappedRow<RowShape> {
|
||||
protected row: RowShape;
|
||||
|
||||
constructor(row: RowShape) {
|
||||
this.row = row;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns The row data as a JSON string.
|
||||
*/
|
||||
toJSON(): string {
|
||||
return JSON.stringify(this.row);
|
||||
}
|
||||
|
||||
/**
|
||||
* Exports the raw row data.
|
||||
* @returns The raw row data.
|
||||
*/
|
||||
unwrap(): RowShape {
|
||||
return this.row;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue