Skip to content

Commit

Permalink
chore: flatten
Browse files Browse the repository at this point in the history
  • Loading branch information
Fyko committed Sep 5, 2023
1 parent 663a043 commit 7cd5855
Show file tree
Hide file tree
Showing 13 changed files with 67 additions and 31 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 26 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,42 @@
[workspace]
members = ["example", "scyllax", "scyllax-macros"]
members = ["example", "scyllax-macros"]
resolver = "2"

[workspace.package]
version = "0.1.0-alpha"
version = "0.1.1-alpha"
license = "MIT OR Apache-2.0"
edition = "2021"
repository = "https://github.com/trufflehq/scyllax"
keywords = ["scylla", "cassandra", "orm", "sqlx", "trufflehq", "truffle", "youtube", "twitch"]
categories = ["database"]
authors = [
"Carter Himmel <[email protected]>"
]
homepage = "https://github.com/trufflehq/scyllax#readme"

[package]
name = "scyllax"
readme = "README.md"
description = "A SQLx and Discord inspired query system for Scylla"
version = { workspace = true }
license = { workspace = true }
edition = { workspace = true }
authors = { workspace = true }
repository = { workspace = true }
homepage = { workspace = true }

[dependencies]
anyhow = { workspace = true }
async-trait = "0.1"
getrandom = "0.2"
mac_address = "1"
once_cell = "1"
scylla = { workspace = true }
scyllax-macros = { version = "0.1.1-alpha", path = "./scyllax-macros" }
thiserror = "1"
tracing = { workspace = true }
uuid = { workspace = true }

[workspace.dependencies]
scyllax-macros = { verison = "0.1.0-alpha", path = "scyllax-macros" }
anyhow = "1"
Expand Down
40 changes: 37 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,44 @@ A SQLx and Discord inspired query system for Scylla.
[![codecov](https://codecov.io/gh/trufflehq/scyllax/graph/badge.svg?token=OGH77YR0TA)](https://codecov.io/gh/trufflehq/scyllax)
[![CI](https://github.com/trufflehq/scyllax/actions/workflows/ci.yml/badge.svg)](https://github.com/trufflehq/scyllax/actions/workflows/ci.yml)

## Example
### 1. Model definition
Before you can write any queries, you have to define a model.
```rust,ignore
#[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.
```rust,ignore
#[select_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.
```rust,ignore
#[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,
}
```

## Features
- [x] Select Queries
- ~~[ ] Insert Queries~~
- ~~[ ] Update Queries~~
- [x] Upsert Queries (https://github.com/trufflehq/scyllax/pull/1)
- [ ] Delete Queries
- [ ] Request Coalescing
Expand All @@ -19,7 +53,7 @@ A SQLx and Discord inspired query system for Scylla.
- [ ] Eject `anyhow`, more refined errors

## Usage
See [examples](examples) for more details.
See the [example](example) for more details.

## References
1. https://www.reddit.com/r/rust/comments/11ki2n7/a_look_at_how_discord_uses_rust_for_their_data/jb8dmrx/
Expand Down
2 changes: 1 addition & 1 deletion example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ publish = false
[dependencies]
anyhow = { workspace = true }
scylla = { workspace = true }
scyllax = { path = "../scyllax" }
scyllax = { path = "../" }
tokio = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
Expand Down
21 changes: 0 additions & 21 deletions scyllax/Cargo.toml

This file was deleted.

1 change: 0 additions & 1 deletion scyllax/README.md

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 7cd5855

Please sign in to comment.