Skip to content

Commit 076e23e

Browse files
committed
[Blog] Edit
1 parent ef781b7 commit 076e23e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Blog/blog/2025-09-16-sea-orm-2.0.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,21 +240,21 @@ How does it work under the hood? It's actually [quite interesting](http://localh
240240

241241
We've planned some exciting new features for SeaORM too.
242242

243-
### Raw SQL macro
243+
### Ergonomic Raw SQL
244244

245-
While already explained in detail in a [previous blog post](https://www.sea-ql.org/blog/2025-08-15-sea-query-raw-sql/), we've integrated the `raw_sql!` macro nicely into SeaORM.
245+
While already explained in detail in a [previous blog post](https://www.sea-ql.org/blog/2025-08-15-sea-query-raw-sql/), we've integrated the `raw_sql!` macro nicely into SeaORM. It's like the `format!` macro but without the risk of SQL injection. It supports nested parameter interpolation, array and tuple expansion, and even repeating group!
246246

247-
It's not a ground-breaking new feature, but it does unlock exciting new ways to use SeaORM. After all, SeaORM isn't just an ORM; it's a flexible SQL toolkit you can tailour to your own programming style. Use it as a backend-agnostic SQLx wrapper, SeaQuery with built-in connection management, or a lightweight ORM with enchanted raw SQL. The choice is yours!
247+
It's not a ground-breaking new feature, as similar functions exist in other dynamic languages. But it does unlock exciting new ways to use SeaORM. After all, SeaORM isn't just an ORM; it's a flexible SQL toolkit you can tailour to your own programming style. Use it as a backend-agnostic SQLx wrapper, SeaQuery with built-in connection management, or a lightweight ORM with enchanted raw SQL. The choice is yours!
248248

249249
#### Find Model by raw SQL
250250

251251
```rust
252-
let id = 1;
252+
let item = Item { id: 1 };
253253

254254
let cake: Option<cake::Model> = cake::Entity::find()
255255
.from_raw_sql(raw_sql!(
256256
Postgres,
257-
r#"SELECT "cake"."id", "cake"."name" FROM "cake" WHERE "id" = {id}"#
257+
r#"SELECT "cake"."id", "cake"."name" FROM "cake" WHERE "id" = {item.id}"#
258258
))
259259
.one(&db)
260260
.await?;

0 commit comments

Comments
 (0)