adding azure table client module

This commit is contained in:
2024-08-11 19:00:46 -05:00
parent a0a3a83cae
commit db96953443
3 changed files with 3 additions and 4 deletions

View File

@@ -1,5 +1,4 @@
export interface TableOptions {
accountName: string;
accountKey: string;
tableName: string;
}

View File

@@ -10,9 +10,9 @@ export class TableService {
private tablesOptions: TableOptions
) {}
async getTableClient(): Promise<TableClient> {
async getTableClient(tableName: string): Promise<TableClient> {
const credential: AzureNamedKeyCredential = new AzureNamedKeyCredential(this.tablesOptions.accountName, this.tablesOptions.accountKey);
const tableClient: TableClient = new TableClient(`https://${this.tablesOptions.accountName}`, this.tablesOptions.tableName, credential);
const tableClient: TableClient = new TableClient(`https://${this.tablesOptions.accountName}.table.core.windows.net`, tableName, credential);
return tableClient;
}