Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sql-mapper/types): add missing UpdateMany interface #2361

Merged

Conversation

mirko-pira
Copy link
Contributor

@mirko-pira mirko-pira commented Apr 9, 2024

This PR introduces the missing UpdateMany interface within the mapper.d.ts file, aiming to enhance the functionality of updating multiple entity rows within the database.

🔎 Use-case:
Issue: Developers attempting to update multiple entity rows simultaneously faced TypeScript errors due to the missing UpdateMany interface.

Resolution: With the UpdateMany interface now included, these TypeScript errors are eliminated. Developers can define batch update operations more naturally within the TypeScript ecosystem, improving code reliability and reducing the need for circumventing type checks.

Documentation already exists:
https://docs.platformatic.dev/docs/next/reference/sql-mapper/entities/api#updatemany

…dating multiple entity rows in the database

The 'UpdateMany' interface is added to the mapper.d.ts file to provide a way to update multiple entity rows in the database. This new interface includes options for specifying the where condition, entity fields to update, fields to be returned, and transaction participation. This enhancement allows for more flexibility and control when updating multiple entity rows in the database.

Signed-off-by: Mirko Pira <mp@mirkodev.com>
@mirko-pira mirko-pira changed the title fix(sql-mapper/types): introduce a new interface for UpdateMany fix(sql-mapper/types): add missing UpdateMany interface Apr 9, 2024
@mcollina
Copy link
Member

mcollina commented Apr 9, 2024

Amazing work! Can you add a few assertions for this in https://github.com/platformatic/platformatic/blob/main/packages/sql-mapper/test/types/mapper.test-d.ts? we use tsd.

…tests

Signed-off-by: Mirko Pira <mp@mirkodev.com>
@mirko-pira
Copy link
Contributor Author

Amazing work! Can you add a few assertions for this in https://github.com/platformatic/platformatic/blob/main/packages/sql-mapper/test/types/mapper.test-d.ts? we use tsd.

Sure, done!

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit 688a39b into platformatic:main Apr 10, 2024
85 of 89 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants