Skip to content

Commit

Permalink
switch examples to use sqlite (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
carllerche authored Nov 1, 2024
1 parent a79a078 commit 2a4f717
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion examples/composite-key/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ publish = false

[dependencies]
toasty = { path = "../../src/toasty" }
toasty-dynamodb = { path = "../../src/db/ddb" }
toasty-sqlite = { path = "../../src/db/sqlite" }

tokio = { version = "1.18", features = ["full"] }
7 changes: 3 additions & 4 deletions examples/composite-key/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::path::PathBuf;
use db::User;

use toasty::Db;
use toasty_dynamodb::DynamoDB;
use toasty_sqlite::Sqlite;

#[tokio::main]
async fn main() {
Expand All @@ -13,9 +13,8 @@ async fn main() {

println!("{schema:#?}");

// Use the in-memory toasty driver
// let driver = Sqlite::new();
let driver = DynamoDB::from_env().await.unwrap();
// Use the in-memory sqlite driver
let driver = Sqlite::in_memory();

let db = Db::new(schema, driver).await;
// For now, reset!s
Expand Down
2 changes: 1 addition & 1 deletion examples/cratehub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ publish = false

[dependencies]
toasty = { path = "../../src/toasty" }
toasty-dynamodb = { path = "../../src/db/ddb" }
toasty-sqlite = { path = "../../src/db/sqlite" }

tokio = { version = "1.18", features = ["full"] }
6 changes: 3 additions & 3 deletions examples/cratehub/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ use std::path::PathBuf;
use db::*;

use toasty::Db;
use toasty_dynamodb::DynamoDB;
use toasty_sqlite::Sqlite;

#[tokio::main]
async fn main() {
let schema_file: PathBuf = std::env::current_dir().unwrap().join("schema.toasty");
let schema = toasty::schema::from_file(schema_file).unwrap();

// Use the in-memory toasty driver
let driver = DynamoDB::from_env().await.unwrap();
// Use the in-memory sqlite driver
let driver = Sqlite::in_memory();

let db = Db::new(schema, driver).await;
// For now, reset!s
Expand Down
2 changes: 1 addition & 1 deletion examples/hello-toasty/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ publish = false

[dependencies]
toasty = { path = "../../src/toasty" }
toasty-dynamodb = { path = "../../src/db/ddb" }
toasty-sqlite = { path = "../../src/db/sqlite" }

tokio = { version = "1.18", features = ["full"] }
8 changes: 3 additions & 5 deletions examples/hello-toasty/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use std::path::PathBuf;
use db::{Todo, User};

use toasty::Db;
// use toasty_sqlite::Sqlite;
use toasty_dynamodb::DynamoDB;
use toasty_sqlite::Sqlite;

fn assert_sync_send<T: Send>(_: T) {}

Expand All @@ -16,9 +15,8 @@ async fn main() {

println!("{schema:#?}");

// Use the in-memory toasty driver
// let driver = Sqlite::new();
let driver = DynamoDB::from_env().await.unwrap();
// Use the in-memory sqlite driver
let driver = Sqlite::in_memory();

let db = Db::new(schema, driver).await;
// For now, reset!s
Expand Down
2 changes: 1 addition & 1 deletion examples/user-has-one-profile/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ publish = false

[dependencies]
toasty = { path = "../../src/toasty" }
toasty-dynamodb = { path = "../../src/db/ddb" }
toasty-sqlite = { path = "../../src/db/sqlite" }

tokio = { version = "1.18", features = ["full"] }
7 changes: 5 additions & 2 deletions examples/user-has-one-profile/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ mod db;
use std::path::PathBuf;

use toasty::Db;
use toasty_dynamodb::DynamoDB;
use toasty_sqlite::Sqlite;

#[tokio::main]
async fn main() {
let schema_file: PathBuf = std::env::current_dir().unwrap().join("schema.toasty");

let schema = toasty::schema::from_file(schema_file).unwrap();
let driver = DynamoDB::from_env().await.unwrap();

// Use the in-memory sqlite driver
let driver = Sqlite::in_memory();

let db = Db::new(schema, driver).await;

// For now, reset!s
Expand Down

0 comments on commit 2a4f717

Please sign in to comment.