Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,9 @@ val users = orm.findAll(User_.city.name eq "Sunnyvale")
interface UserRepository : EntityRepository<User, Int> {
fun findByCity(name: String) = findAll(User_.city.name eq name)
}

// Drop to SQL whenever you want it. Interpolations become bind parameters.
val users = orm.query { """
SELECT ${User::class}
FROM ${User::class}
WHERE ${User_.city.name} = $cityName""" }.resultList<User>()
```

The `city` graph loads in a single query, `User_` is generated at compile time so a typo is a compile error, and every interpolation is a bind parameter. What you write is what runs.
The `city` graph loads in a single query, and `User_` is generated at compile time so a typo is a compile error. What you write is what runs.

## Why Storm

Expand Down
24 changes: 5 additions & 19 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,11 @@ interface UserRepository : EntityRepository<User, Int> {
fun findByCityName(name: String) = findAll(User_.city.name eq name)
}

// Block DSL — build queries with where, orderBy, joins, pagination
val users = userRepository.select {
where(User_.city.name eq "Sunnyvale")
orderBy(User_.name)
}.resultList

// SQL Template for full control; parameterized by default, SQL injection safe
val users = orm.query { """
SELECT ${User::class}
FROM ${User::class}
WHERE ${User_.city.name} = $cityName"""
}.resultList<User>()
// Query builder — where, orderBy, joins, pagination
val users = userRepository.select()
.where(User_.city.name eq "Sunnyvale")
.orderBy(User_.name)
.resultList
```

Full coroutine support with `Flow` for streaming and programmatic transactions:
Expand Down Expand Up @@ -118,13 +111,6 @@ List<User> users = orm.entity(User.class)
.where(User_.city.name, EQUALS, "Sunnyvale")
.orderBy(User_.name)
.getResultList();

// SQL Template for full control; parameterized by default, SQL injection safe
List<User> users = orm.query(RAW."""
SELECT \{User.class}
FROM \{User.class}
WHERE \{User_.city.name} = \{cityName}
""").getResultList(User.class);
```

</TabItem>
Expand Down
Loading