-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
18dbd7f
commit e937099
Showing
3 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { BatchedUpdateNotification, QueryResult } from '@powersync/common'; | ||
|
||
/** | ||
* Proxied query result does not contain a function for accessing row values | ||
*/ | ||
export type ProxiedQueryResult = Omit<QueryResult, 'rows'> & { | ||
rows: { | ||
_array: any[]; | ||
length: number; | ||
}; | ||
}; | ||
export type OnTableChangeCallback = (event: BatchedUpdateNotification) => void; | ||
|
||
/** | ||
* @internal | ||
* An async Database connection which provides basic async SQL methods. | ||
* This is usually a proxied through a web worker. | ||
*/ | ||
export interface AsyncDatabaseConnection { | ||
init(): Promise<void>; | ||
close(): Promise<void>; | ||
execute(sql: string, params?: any[]): Promise<ProxiedQueryResult>; | ||
executeBatch(sql: string, params?: any[]): Promise<ProxiedQueryResult>; | ||
registerOnTableChange(callback: OnTableChangeCallback): () => void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { AsyncDatabaseConnection } from './AsyncDatabaseConnection'; | ||
|
||
export interface ProxiedDatabaseConnection extends AsyncDatabaseConnection { | ||
/** | ||
* Get a MessagePort which can be used to share the internals of this connection. | ||
*/ | ||
getMessagePort(): MessagePort; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters