Skip to content

Commit

Permalink
Add method for creating views
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljbruce committed Aug 29, 2024
1 parent dd0f1bc commit 4cef1fe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/authorized-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
} from './row';
import {RowDataUtils, RowProperties} from './row-data-utils';
import {RawFilter} from './filter';
import {Table} from './table';

interface FilterInformation {
filter: RawFilter;
Expand All @@ -39,11 +40,11 @@ interface IncrementInformation {
* @param {string} id Unique identifier of the table.
*
*/
class AuthorizedView extends TabularApiSurface {
export class AuthorizedView extends TabularApiSurface {
private readonly rowData: {[id: string]: {}};

constructor(instance: Instance, id: string) {
super(instance, id);
constructor(table: Table, viewName: string) {
super(table.instance, table.id, viewName);
this.rowData = {};
}

Expand Down
5 changes: 5 additions & 0 deletions src/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import {
GetRowsCallback,
GetRowsResponse,
} from './tabular-api-surface';
import {AuthorizedView} from './authorized-view';

export {
InsertRowsCallback,
Expand Down Expand Up @@ -1163,6 +1164,10 @@ export class Table extends TabularApiSurface {
);
}

view(viewName: string): AuthorizedView {
return new AuthorizedView(this, viewName);
}

waitForReplication(): Promise<WaitForReplicationResponse>;
waitForReplication(callback: WaitForReplicationCallback): void;
/**
Expand Down

0 comments on commit 4cef1fe

Please sign in to comment.