Skip to content

Commit 9e0b8e7

Browse files
wip
1 parent 716382c commit 9e0b8e7

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/modules/db/sqlx/mod.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -664,11 +664,11 @@ impl SqlxConnection {
664664
// needs to be called from inside a tokio runtime even if not async
665665
pub fn get_or_new(
666666
protocol_type: &'static str,
667-
host: String,
667+
host: &str,
668668
port: u16,
669-
user: String,
670-
pass: String,
671-
db_opt: Option<String>,
669+
user: &str,
670+
pass: &str,
671+
db_opt: Option<&str>,
672672
) -> Result<Arc<SqlxConnection>, JsError> {
673673
// todo, actually parse args
674674
//url, port, user, pass, dbSchema
@@ -914,7 +914,7 @@ fn create_connect_function(
914914
async move {
915915
// get_or_new moet aangeroepen worden in een tokio runtime.. omdat we dat nu in een async functie doen hoeven we ook niet meer connect_lazy te gebruiken maar gewoon connect
916916
let con =
917-
SqlxConnection::get_or_new(protocol, host, port, user, pass, db_name_opt)?;
917+
SqlxConnection::get_or_new(protocol, host.as_str(), port, user.as_str(), pass.as_str(), db_name_opt.as_deref())?;
918918
Ok(con)
919919
},
920920
|realm, con| {
@@ -1711,12 +1711,11 @@ unsafe extern "C" fn fn_transaction_commit(
17111711

17121712
#[cfg(test)]
17131713
pub mod tests {
1714-
1715-
use std::panic;
17161714
//use log::LevelFilter;
17171715
use quickjs_runtime::builder::QuickJsRuntimeBuilder;
17181716
use quickjs_runtime::jsutils::Script;
17191717
use quickjs_runtime::values::JsValueFacade;
1718+
use std::panic;
17201719

17211720
#[tokio::test]
17221721
async fn _test_sqlx() {

0 commit comments

Comments
 (0)