SeaQuery handles the sequencing of parameters (e.g., $1, $2 or ?) automatically. When you use expressions or custom values, SeaQuery ensures the correct order of values is maintained in the resulting Values object, preventing "off by one" errors common in raw SQL.
assert_eq!(
Query::select()
.expr(Expr::col("size_w").add(1).mul(2))
.from("glyph")
.and_where(Expr::col("image").like("A"))
.and_where(Expr::col("id").is_in([3, 4, 5]))
.build(PostgresQueryBuilder),
(
r#"SELECT ("size_w" + $1) * $2 FROM "glyph" WHERE "image" LIKE $3 AND "id" IN ($4, $5, $6)"#
.to_owned(),
Values(vec![
1.into(),
2.into(),
"A".to_owned().into(),
3.into(),
4.into(),
5.into(),
])
)
);