Comments (6)
Here is a patch if they don't accept the PR anytime soon , just use findAll2
import { TableEntityQueryOptions } from '@azure/data-tables';
import { AzureTableStorageRepository } from '@nestjs/azure-database';
import { Logger } from '@nestjs/common';
export * from '@nestjs/azure-database';
const logger = new Logger('AzureStorageRepository');
// Remove the verbose output
// eslint-disable-next-line @typescript-eslint/no-empty-function
console.table = function () {};
declare module '@nestjs/azure-database' {
interface AzureTableStorageRepository<T> {
findAll2(options?: { queryOptions?: TableEntityQueryOptions }): Promise<T[]>;
}
}
AzureTableStorageRepository.prototype.findAll2 = async function <T>(
options: { queryOptions?: TableEntityQueryOptions } = {}
): Promise<T[]> {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
logger.debug(`Looking for entities in table: ${this.tableName}`);
try {
const records = this.tableClientInstance.listEntities({
queryOptions: options.queryOptions,
});
const entities = [];
for await (const entity of records) {
entities.push(entity);
}
logger.debug(`Entities fetched successfully`);
return entities as T[];
} catch (error) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
return this.handleRestErrors(error);
}
};
from azure-database.
I just ran into this same issue , absolutely need to filter by partitionKey at a minimum
from azure-database.
I added a PR to fix this , I been using filtering directly to azure for some time now
from azure-database.
I added a PR to fix this , I been using filtering directly to azure for some time now
For backwards compatibility I would make the options parameter optional if and actual options is passed so then it would use it, if not would works as is right now.
My take on it was like this as I don't need other thing than the filter to be different:
async findAll(filter?: string): Promise<T[]> {
logger.debug(`Looking for entities in table: ${this.tableName}`);
try {
let options: ListTableEntitiesOptions = {};
if (typeof filter !== 'undefined') {
options = {
queryOptions: { filter: `${filter}`, select: [] },
};
}
const records = this.tableClientInstance.listEntities(options);
...
from azure-database.
From what I saw in the code, there was no filter?:string param in the latest code.
async findAll(): Promise<T[]> {
The way I did it was backwards compatible and provides the full support to the listEntities() including the select which is important when needing to delete lots of large rows.
async findAll(options: { queryOptions?: TableEntityQueryOptions } = {}): Promise<T[]>
I use "select" to query and return just the rowKey using the select:['RowKey']. and iterate the results to do targeted deletes. Important when storing large blob data.
I can change it to the question mark notation as opposed to the default , if thats what you want. would be equally backward compatible. I like to use a generic options param because it gives you increased flexibility to adding additional backward compatible features in the future.
from azure-database.
Related Issues (20)
- Support configuring custom container names HOT 1
- Can't use cosmoDB readonly key / Must use cosmoDB readwrite key HOT 4
- Add support for async module initialization HOT 1
- Te package no contains Cosmos DB library HOT 6
- Cannot find module '@nestjs/azure-database' or its corresponding type declarations. HOT 7
- Class 'AzureTableStorageService' incorrectly implements interface 'TableService' HOT 3
- Regular Expression Denial of Service (ReDoS) HOT 1
- Dependency Dashboard
- Cosmos DB Mongodb API HOT 1
- How can a Table Query be performed on Azure Table Storage HOT 1
- Connection to Cosmos Hangs HOT 1
- Batch operations
- CosmosDB Error on version 9+ HOT 13
- getModelToken should be exported
- azure-storage is deprecated HOT 3
- Migrate off `@azure/ms-rest-js`
- Disable DEBUG level logging in nestjs/azure-database
- strictNullChecks must be false
- Is there a plan to support hierarchical partition keys? HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-database.