Skip to content

Conversation

@tisonkun
Copy link
Collaborator

... with Kimi CLI.

- 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)
Signed-off-by: tison <wander4096@gmail.com>
- 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
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
@tisonkun tisonkun merged commit b51246e into main Jan 26, 2026
9 checks passed
@tisonkun tisonkun deleted the kimi-driven branch January 26, 2026 07:21
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.

2 participants