The Firebase DataConnect
service interface.
Signature:
export declare class DataConnect
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
app | App | ||
connectorConfig | ConnectorConfig |
Methods
Method | Modifiers | Description |
---|---|---|
executeGraphql(query, options) | Execute an arbitrary GraphQL query or mutation | |
executeGraphqlRead(query, options) | Execute an arbitrary read-only GraphQL query | |
insert(tableName, variables) | Insert a single row into the specified table. | |
insertMany(tableName, variables) | Insert multiple rows into the specified table. | |
upsert(tableName, variables) | Insert a single row into the specified table, or update it if it already exists. | |
upsertMany(tableName, variables) | Insert multiple rows into the specified table, or update them if they already exist. |
DataConnect.app
Signature:
readonly app: App;
DataConnect.connectorConfig
Signature:
readonly connectorConfig: ConnectorConfig;
DataConnect.executeGraphql()
Execute an arbitrary GraphQL query or mutation
Signature:
executeGraphql<GraphqlResponse, Variables>(query: string, options?: GraphqlOptions<Variables>): Promise<ExecuteGraphqlResponse<GraphqlResponse>>;
Parameters
Parameter | Type | Description |
---|---|---|
query | string | The GraphQL query or mutation. |
options | GraphqlOptions<Variables> | Optional GraphqlOptions when executing a GraphQL query or mutation. |
Returns:
Promise<ExecuteGraphqlResponse<GraphqlResponse>>
A promise that fulfills with a ExecuteGraphqlResponse
.
DataConnect.executeGraphqlRead()
Execute an arbitrary read-only GraphQL query
Signature:
executeGraphqlRead<GraphqlResponse, Variables>(query: string, options?: GraphqlOptions<Variables>): Promise<ExecuteGraphqlResponse<GraphqlResponse>>;
Parameters
Parameter | Type | Description |
---|---|---|
query | string | The GraphQL read-only query. |
options | GraphqlOptions<Variables> | Optional GraphqlOptions when executing a read-only GraphQL query. |
Returns:
Promise<ExecuteGraphqlResponse<GraphqlResponse>>
A promise that fulfills with a ExecuteGraphqlResponse
.
DataConnect.insert()
Insert a single row into the specified table.
Signature:
insert<GraphQlResponse, Variables extends object>(tableName: string, variables: Variables): Promise<ExecuteGraphqlResponse<GraphQlResponse>>;
Parameters
Parameter | Type | Description |
---|---|---|
tableName | string | The name of the table to insert data into. |
variables | Variables | The data object to insert. The keys should correspond to the column names. |
Returns:
Promise<ExecuteGraphqlResponse<GraphQlResponse>>
A promise that fulfills with a ExecuteGraphqlResponse
.
DataConnect.insertMany()
Insert multiple rows into the specified table.
Signature:
insertMany<GraphQlResponse, Variables extends Array<unknown>>(tableName: string, variables: Variables): Promise<ExecuteGraphqlResponse<GraphQlResponse>>;
Parameters
Parameter | Type | Description |
---|---|---|
tableName | string | The name of the table to insert data into. |
variables | Variables | An array of data objects to insert. Each object's keys should correspond to the column names. |
Returns:
Promise<ExecuteGraphqlResponse<GraphQlResponse>>
A promise that fulfills with a ExecuteGraphqlResponse
.
DataConnect.upsert()
Insert a single row into the specified table, or update it if it already exists.
Signature:
upsert<GraphQlResponse, Variables extends object>(tableName: string, variables: Variables): Promise<ExecuteGraphqlResponse<GraphQlResponse>>;
Parameters
Parameter | Type | Description |
---|---|---|
tableName | string | The name of the table to upsert data into. |
variables | Variables | The data object to upsert. The keys should correspond to the column names. |
Returns:
Promise<ExecuteGraphqlResponse<GraphQlResponse>>
A promise that fulfills with a ExecuteGraphqlResponse
.
DataConnect.upsertMany()
Insert multiple rows into the specified table, or update them if they already exist.
Signature:
upsertMany<GraphQlResponse, Variables extends Array<unknown>>(tableName: string, variables: Variables): Promise<ExecuteGraphqlResponse<GraphQlResponse>>;
Parameters
Parameter | Type | Description |
---|---|---|
tableName | string | The name of the table to upsert data into. |
variables | Variables | An array of data objects to upsert. Each object's keys should correspond to the column names. |
Returns:
Promise<ExecuteGraphqlResponse<GraphQlResponse>>
A promise that fulfills with a ExecuteGraphqlResponse
.