Skip to content

Commit

Permalink
Merge pull request #90 from dxfrontier/remove-deprecated-limit
Browse files Browse the repository at this point in the history
Remove deprecated limit
  • Loading branch information
dragolea authored Sep 9, 2024
2 parents d86cf47 + 1b0305b commit 9c5e41d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 30 deletions.
26 changes: 0 additions & 26 deletions lib/util/find/FindBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,32 +179,6 @@ class FindBuilder<T, Keys> extends BaseFind<T, Keys> {
return selectBuilder;
}

/**
* Limits the result set with an optional offset.
*
* @deprecated Use `this.builder().find().paginate` instead of `this.builder().find().limit`.
* @param options - The options for limiting the result set.
* @param options.limit - The limit for the result set.
* @param options.skip - Optional. The number of items to skip in the result set.
* @returns FindBuilder instance
*
* @example
* const results = await this.builder().find({
* name: 'A company name',
* })
* .limit({ limit: 10, skip: 5 })
* .execute();
*/
public limit(options: { limit: number; skip?: number }): this {
if (options.skip !== null) {
void this.select.limit(options.limit, options.skip);
return this;
}

void this.select.limit(options.limit);
return this;
}

/**
* Limits the result set with an optional offset.
*
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dxfrontier/cds-ts-repository",
"version": "2.0.4",
"version": "2.0.5",
"description": "The goal of SAP CAP CDS-QL BaseRepository is to significantly reduce the boilerplate code required to implement data access layers for persistance entities by providing out of the box actions on the database like .create(), .createMany(), .getAll(), .update(), .find(), .exists() ...",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand Down
2 changes: 1 addition & 1 deletion test/unit/draft/SELECT.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ describe('SELECT - drafts', () => {
const limit = await bookEventDraftRepository
.builderDraft()
.find({ types: 'BOOK_LUNCH' })
.limit({ limit: 1, skip: 1 })
.paginate({ limit: 1, skip: 1 })
.execute();

expect(limit).toHaveLength(1);
Expand Down

0 comments on commit 9c5e41d

Please sign in to comment.