Line data Source code
1 : import * as buf from '@bufbuild/protobuf';
2 : import * as proto from '../proto.js';
3 : import type { QueryExecutionArgs } from './query_execution_args.js';
4 :
5 : /// The channel of a connection, the connectors pass a channel override first while the connection is set up
6 1 : export function requireChannel<T>(channel: T | null, connector: string): T {
7 1 : if (channel == null) {
8 1 : throw new Error(`${connector} channel is not set up`);
9 : }
10 1 : return channel;
11 1 : }
12 :
13 : /// The query param of a query execution
14 1 : export function queryParam(args: QueryExecutionArgs): proto.salesforce_hyperdb_grpc_v1.pb.QueryParam {
15 1 : return buf.create(proto.salesforce_hyperdb_grpc_v1.pb.QueryParamSchema, { query: args.query });
16 1 : }
|