Skip to content

Changes the where clause behavior #11

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

Merged
merged 1 commit into from
Sep 26, 2023
Merged

Conversation

belchior
Copy link
Owner

@belchior belchior commented Sep 25, 2023

Breaking changes

This PR changes the behavior of the where clause to support the OR operator. The alias builder.and("...") was removed in favor of the builder.where_clause("...").

How to migrate

You will have to replace all use of the builder.and("...") to builder.where_clause("...")

New features

Was added in the Select, Update and Delete builders the method builder.where_or("...") to support concatenations using the OR operator.

use sql_query_builder as sql;

let query = sql::Select::new()
  .select("*")
  .from("users")
  .where_clause("login = 'joe'")
  .where_or("login = 'max'")
  .as_string();
SELECT *
FROM users
WHERE
  login = 'joe'
  OR login = 'max'

@belchior belchior self-assigned this Sep 25, 2023
@belchior belchior changed the title changes the where clause behavior Changes the where clause behavior Sep 25, 2023
@belchior belchior merged commit 0db0ce2 into main Sep 26, 2023
@belchior belchior deleted the change-where-clause-behavior branch September 26, 2023 09:29
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.

1 participant