Compare commits
2 Commits
feature/8-
...
feature/10
| Author | SHA1 | Date | |
|---|---|---|---|
| 2248b1e6d7 | |||
| e192dcdb05 |
@@ -1,4 +1,3 @@
|
|||||||
export interface TableOptions {
|
export interface TableOptions {
|
||||||
accountName: string;
|
connectionString;
|
||||||
accountKey: string;
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { TableOptions } from './az-table.interface';
|
import { TableOptions } from './az-table.interface';
|
||||||
import { TABLE_OPTIONS } from './az-table.constants';
|
import { TABLE_OPTIONS } from './az-table.constants';
|
||||||
import { TableClient, AzureNamedKeyCredential } from '@azure/data-tables';
|
import { TableClient } from '@azure/data-tables';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class TableService {
|
export class TableService {
|
||||||
@@ -11,8 +11,7 @@ export class TableService {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
async getTableClient(tableName: string): Promise<TableClient> {
|
async getTableClient(tableName: string): Promise<TableClient> {
|
||||||
const credential: AzureNamedKeyCredential = new AzureNamedKeyCredential(this.tablesOptions.accountName, this.tablesOptions.accountKey);
|
const tableClient: TableClient = new TableClient(this.tablesOptions.connectionString, tableName);
|
||||||
const tableClient: TableClient = new TableClient(`https://${this.tablesOptions.accountName}.table.core.windows.net`, tableName, credential);
|
|
||||||
|
|
||||||
return tableClient;
|
return tableClient;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user