-
Notifications
You must be signed in to change notification settings - Fork 1
/
HdbextAsync.ts
29 lines (23 loc) · 996 Bytes
/
HdbextAsync.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { Connection } from "@sap/hana-client";
import * as Hdbext from "@sap/hdbext";
import { promisify } from "util";
import { HanaClientAsync } from "./HanaClientAsync";
class HdbextAsync {
public readonly loadProcedure: (connection: Connection,
schemaName: string | null,
procedureName: string) => Promise<Hdbext.ProcedureFunction | undefined>;
private readonly createConnectionAsync: (hanaConfig: {}) => Promise<Connection>;
/**
* Creates @class HdbextAsync.
* @param hdbext object imported from `@sap/hdbext`.
*/
constructor(public readonly hdbext: Hdbext.hdbextObj) {
this.loadProcedure = promisify(hdbext.loadProcedure);
this.createConnectionAsync = promisify(hdbext.createConnection);
}
public async createConnection(hanaConfig: {}) {
const connection = await this.createConnectionAsync(hanaConfig);
return new HanaClientAsync(this, connection);
}
}
export { HdbextAsync };