generated from fast/template
-
Notifications
You must be signed in to change notification settings - Fork 1
feat: support more query features #3
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Add JoinType::InnerJoin variant - Add Select::inner_join() method - Port select_9 test from sea-query
ON clause supports multiple conditions via .and() expression combinator.
The column reference should be (character, character) not just character to match the expected SQL output with table prefix: "character"."character"
- Add Order enum (Asc, Desc) - Add OrderExpr struct - Add Select::order_by() method - Add ORDER BY SQL generation - Port select_11 test from sea-query
- Add Select::order_by_columns() method for setting multiple ORDER BY columns in one call - Port select_12 test from sea-query
Verify order_by_columns supports (table, column) qualified references: ((glyph, id), Order::Asc) => glyph.id ASC
- Add Keyword enum with Null variant - Expr::is_null() uses BinaryOp::Is with Keyword::Null - More extensible than Expr::Null for future keywords Signed-off-by: tison <wander4096@gmail.com>
Add Expr::is_not_null() for IS NOT NULL checks.
- Add Expr::between(a, b) method - Handle BETWEEN special case in write_expr to avoid parentheses - BETWEEN a AND b instead of BETWEEN (a AND b)
- Add Expr::like() and select_21 test - Fix: same operator (e.g., OR chain) should not add parentheses - Change well_known_high_precedence to return true when operators are the same, indicating no parentheses needed
Add standalone is_left_associative() function to check if an operator is left-associative (And, Or, Add, Sub, Mul, Div). Only skip parentheses for same-operator chains when the operator is left-associative.
Split parentheses logic into two clear layers: - well_known_high_precedence(): handles operator precedence only - well_known_left_associative(): handles left-associativity In write_binary_expr, explicitly combine both checks for the left-associative case. More explicit and follows sea-query style.
…aits
- select_28: multiple OR conditions using .or() chaining
- select_29: complex expression in SELECT list using .expr()
- select_30: arithmetic comparison in WHERE clause
Implement std::ops::{Add,Sub,Mul,Div} for Expr to support ergonomic
arithmetic expressions like (Expr::col(a) * 2) + Expr::col(b).div(3).
pqb generates cleaner SQL without redundant outer parens - semantically
equivalent to sea-query output.
Remove std::ops::{Add,Sub,Mul,Div} implementations - they cannot handle
reverse operations (e.g., 2 + Expr) and may confuse operator precedence.
Use explicit method chaining instead:
Expr::col(a).mul(2).add(Expr::col(b).div(3))
This is clearer, self-documenting, and avoids the limitations of orphan
rules for external types.
Demonstrates building arithmetic expressions dynamically using Rust's iterator fold: (1..10).fold(Expr::value(0), |expr, i| expr.add(i)) produces 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
... with Kimi CLI.