Expand description
§Scyllax (sɪl-æks)
A SQLx and Discord inspired query system for ScyllaDB
§Example
§1. Model definition
Before you can write any queries, you have to define a model.
ⓘ
#[derive(Clone, Debug, FromRow, PartialEq, ValueList, Entity)]
pub struct PersonEntity {
#[pk]
pub id: uuid::Uuid,
pub email: String,
pub created_at: i64,
}
§2. Select queries
With the [select_query
] attribute, it’s easy to define select queries.
ⓘ
#[read_query(
query = "select * from person where id = ? limit 1",
entity_type = "PersonEntity"
)]
pub struct GetPersonById {
pub id: Uuid,
}
§3. Upsert queries
With the [upsert_query
] attribute, it’s easy to define upsert queries.
ⓘ
#[upsert_query(table = "person", name = UpsertPerson)]
#[derive(Clone, Debug, FromRow, PartialEq, ValueList, Entity)]
pub struct PersonEntity {
#[pk]
pub id: uuid::Uuid,
pub email: String,
pub created_at: i64,
}
Modules§
- collection
- entity
- error
- ScyllaX error types
- executor
- The
scyllax
Executor
processes queries. - maybe_
unset - A wrapper around a value that can be unincluded but not overwritten/made null
- prelude
- Re-exports of the most commonly used types and traits.
- queries
- rows
- Macros for matching rows from a
scylla::QueryResult
- util
- Utility functions
Macros§
- match_
row - Take a QueryResult and return a
Result<Option<T>>
Example: - match_
rows - Take a QueryResult and return a
Result<Vec<T>>
Example: