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): enhance null value type support and documentation #2360

Merged

Conversation

mirko-pira
Copy link
Contributor

For instance, without explicit support for null values in the WhereCondition interface, developers could inadvertently produce queries that do not behave as expected in scenarios involving null. Similarly, lacking clear documentation might lead to inconsistent query formulations or misunderstandings about how null comparisons are conducted in SQL, affecting data retrieval or manipulation tasks.

With these enhancements, the interface now directly accommodates null values, reducing potential for errors and increasing query precision. Improved documentation further aids developers, offering detailed insights into the operation of eq and neq with null, thereby standardizing practices and bolstering the robustness of applications built on our platform.

♻️ (mapper.d.ts): Update WhereCondition interface to allow null values for eq and neq properties
This update introduces the ability to explicitly set null values for the eq and neq properties within the WhereCondition interface. This change promotes greater flexibility and accuracy in query formulation, aligning with SQL standards for null handling.

✨ (api.md): Enhance documentation on null value handling with eq and neq operators in SQL queries
The documentation has been further refined with additional details on how null values are treated when using the eq and neq operators in SQL queries, enhancing understanding and usability for developers.

🔎 Use-case:
Prior to these updates, developers might face ambiguity when setting null values for eq and neq properties or when interpreting documentation regarding null handling in SQL queries. Misinterpretations or misconfigurations could lead to unintended query results or typescript errors.

image

…s for eq and neq properties

The WhereCondition interface has been updated to allow null values for the eq and neq properties. This change improves the flexibility of the interface by allowing these properties to be explicitly set to null when needed.

Signed-off-by: Mirko Pira <mp@mirkodev.com>
…ll values in SQL queries

✨ (api.md): Improve documentation on handling null values when using `eq` and `neq` operators in SQL queries
The documentation now includes a section explaining how the `eq` and `neq` operators handle null values in SQL queries. This addition enhances the clarity and understanding of how these operators behave when dealing with null values, providing users with a better reference for utilizing them in their queries.

Signed-off-by: Mirko Pira <mp@mirkodev.com>
Signed-off-by: Mirko Pira <mp@mirkodev.com>
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.

Good work! Can you please add a couple of assertions in the test types for this?

…ll in mapper tests

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

mirko-pira commented Apr 9, 2024

Good work! Can you please add a couple of assertions in the test types for this?

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 b8902ce into platformatic:main Apr 9, 2024
85 of 90 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