Skip to content

Commit

Permalink
Merge branch 'feature/backend-file'
Browse files Browse the repository at this point in the history
Conflicts:
	Cargo.toml
  • Loading branch information
bobrippling committed Feb 22, 2024
2 parents b2d3658 + 7d6fa0b commit 77d22c4
Show file tree
Hide file tree
Showing 9 changed files with 567 additions and 434 deletions.
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pretty_env_logger = "0.5.0"
cookie = "0.18.0"
warp = "0.3.6"

sqlx = { version = "0.6.3", features = ["sqlite", "time", "offline"]}
sqlx = { version = "0.6.3", features = ["sqlite", "time", "offline"], optional = true }
# sqlx-cli

base64_light = "0.1.5"
Expand All @@ -32,3 +32,6 @@ uuid = { version = "1.4.1", features = ["v4"] }
default = ["rustls"]
native-tls = ["sqlx/runtime-tokio-native-tls"]
rustls = ["sqlx/runtime-tokio-rustls", "warp/tokio-rustls"]

backend-sql = ["dep:sqlx"]
backend-file = []
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ To update the schema:
```sh
export DATABASE_URL=sqlite://pod.sql
cargo install sqlx-cli
cargo sqlx prepare -- --tests
cargo sqlx prepare -- --tests --features backend-sql
git commit -m 'Update sqlx snapshot' sqlx-data.json
```

Expand Down
30 changes: 10 additions & 20 deletions sqlx-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,6 @@
},
"query": "\n SELECT *\n FROM users\n WHERE username = ?\n "
},
"3d4a325e98d31cb1ff2a7396da6a0712f0abb0dc5203deb5738734e83c198cf6": {
"describe": {
"columns": [],
"nullable": [],
"parameters": {
"Right": 1
}
},
"query": "\n UPDATE users\n SET session_id = NULL\n WHERE username = ?\n "
},
"3fb9d968e52bdbfc981705fd91aa8b6b2c3d573a2e7dce7fe9652c1913a2f5bd": {
"describe": {
"columns": [
Expand Down Expand Up @@ -80,16 +70,6 @@
},
"query": "\n UPDATE subscriptions\n SET\n deleted = ?\n WHERE username = ?\n AND device = ?\n AND url = ?\n AND deleted IS NULL\n "
},
"4a1e8d47d3e4934dc2d652725ca1adb882ed387bf6565d6d27f5392ab6b77560": {
"describe": {
"columns": [],
"nullable": [],
"parameters": {
"Right": 2
}
},
"query": "\n UPDATE users\n SET session_id = ?\n WHERE username = ?\n "
},
"57d484d4581d50a8d41a914e79e6a0870f73f7915acbe7ba84783bcf15aaadc6": {
"describe": {
"columns": [
Expand Down Expand Up @@ -282,6 +262,16 @@
},
"query": "\n INSERT INTO subscriptions\n (username, device, url, created)\n VALUES\n (?, ?, ?, ?) -- `deleted` <- NULL\n ON CONFLICT\n DO NOTHING\n "
},
"d8efd2d5bcf76f9fdd7e7ad475963148eacd57d4e3415c42508c932b5b516769": {
"describe": {
"columns": [],
"nullable": [],
"parameters": {
"Right": 2
}
},
"query": "\n UPDATE users\n SET session_id = ?\n WHERE username = ?\n "
},
"f2909b05f07252d28cf3cf9f14d2a88a4e2805d3f012794ac7eca6250de084a5": {
"describe": {
"columns": [
Expand Down
15 changes: 15 additions & 0 deletions src/backend.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#[derive(Debug)]
pub enum FindError {
NotFound,
Internal,
}

#[cfg(feature = "backend-sql")]
mod backend_sql;
#[cfg(feature = "backend-sql")]
pub use backend_sql::*;

#[cfg(feature = "backend-file")]
mod backend_file;
#[cfg(feature = "backend-file")]
pub use backend_file::*;
1 change: 1 addition & 0 deletions src/backend/backend_file.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//todo
Loading

0 comments on commit 77d22c4

Please sign in to comment.