Skip to main content

Interface: BaseTableWriter<DataModel, TableName>

server.BaseTableWriter

Type parameters

NameType
DataModelextends GenericDataModel
TableNameextends TableNamesInDataModel<DataModel>

Hierarchy

Methods

get

get(id): Promise<null | DocumentByName<DataModel, TableName>>

Fetch a single document from the table by its GenericId.

Parameters

NameTypeDescription
idGenericId<TableName>The GenericId of the document to fetch from the database.

Returns

Promise<null | DocumentByName<DataModel, TableName>>

Inherited from

BaseTableReader.get

Defined in

server/database.ts:76


query

query(): QueryInitializer<NamedTableInfo<DataModel, TableName>>

Begin a query for the table.

Queries don't execute immediately, so calling this method and extending its query are free until the results are actually used.

Returns

QueryInitializer<NamedTableInfo<DataModel, TableName>>

Inherited from

BaseTableReader.query

Defined in

server/database.ts:88


insert

insert(value): Promise<GenericId<TableName>>

Insert a new document into the table.

Parameters

NameTypeDescription
valueWithoutSystemFields<DocumentByName<DataModel, TableName>>The Value to insert into the given table.

Returns

Promise<GenericId<TableName>>

Defined in

server/database.ts:234


patch

patch(id, value): Promise<void>

Patch an existing document, shallow merging it with the given partial document.

New fields are added. Existing fields are overwritten. Fields set to undefined are removed.

Parameters

NameTypeDescription
idGenericId<TableName>The GenericId of the document to patch.
valuePartial<DocumentByName<DataModel, TableName>>The partial GenericDocument to merge into the specified document. If this new value specifies system fields like _id, they must match the document's existing field values.

Returns

Promise<void>

Defined in

server/database.ts:249


replace

replace(id, value): Promise<void>

Replace the value of an existing document, overwriting its old value.

Parameters

NameTypeDescription
idGenericId<TableName>The GenericId of the document to replace.
valueWithOptionalSystemFields<DocumentByName<DataModel, TableName>>The new GenericDocument for the document. This value can omit the system fields, and the database will fill them in.

Returns

Promise<void>

Defined in

server/database.ts:261


delete

delete(id): Promise<void>

Delete an existing document.

Parameters

NameTypeDescription
idGenericId<TableName>The GenericId of the document to remove.

Returns

Promise<void>

Defined in

server/database.ts:271