Skip to content

Commit

Permalink
minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
amitu committed Dec 30, 2024
1 parent 6c0a930 commit 6c0afe8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion fastn-ds/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ impl DocumentStore {
return Ok(p.get().clone());
}

let pool = fastn_wasm::create_pool(db_path.as_str()).await?;
let pool = fastn_wasm::pg::create_pool(db_path.as_str()).await?;

fastn_wasm::insert_or_update(&self.pg_pools, db_path.to_string(), pool.clone());

Expand Down
4 changes: 1 addition & 3 deletions v0.5/fastn-wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,18 @@
extern crate self as fastn_wasm;

pub(crate) mod aws;
mod create_pool;
pub(crate) mod crypto;
pub(crate) mod ds;
pub(crate) mod env;
pub(crate) mod helpers;
pub(crate) mod http;
pub(crate) mod macros;
mod pg;
pub mod pg;
mod process_http_request;
pub(crate) mod register;
mod sqlite;
mod store;

pub use create_pool::create_pool;
pub use process_http_request::process_http_request;
pub(crate) use store::Conn;
pub use store::{ConnectionExt, SQLError, Store, StoreExt, StoreImpl};
Expand Down
2 changes: 1 addition & 1 deletion v0.5/fastn-wasm/src/pg/connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl<STORE: fastn_wasm::StoreExt> fastn_wasm::Store<STORE> {
return match self.pg_pools.get(db_url.as_str()) {
Some(pool) => get_client(pool.get(), &mut clients).await,
None => {
let pool = fastn_wasm::create_pool(db_url.as_str()).await?;
let pool = fastn_wasm::pg::create_pool(db_url.as_str()).await?;
fastn_wasm::insert_or_update(&self.pg_pools, db_url.to_string(), pool);
get_client(
self.pg_pools.get(db_url.as_str()).unwrap().get(),
Expand Down
File renamed without changes.
12 changes: 7 additions & 5 deletions v0.5/fastn-wasm/src/pg/mod.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
mod batch_execute;
mod connect;
mod create_pool;
mod db_error;
mod execute;
mod query;

pub use batch_execute::batch_execute;
pub use connect::connect;
pub use db_error::pg_to_shared;
pub use execute::execute;
pub use query::query;
pub(crate) use batch_execute::batch_execute;
pub(crate) use connect::connect;
pub use create_pool::create_pool;
pub(crate) use db_error::pg_to_shared;
pub(crate) use execute::execute;
pub(crate) use query::query;

#[derive(serde::Deserialize, Debug)]
pub struct Query {
Expand Down

0 comments on commit 6c0afe8

Please sign in to comment.