How to integrate with sqlx #262
Unanswered
mikebelanger
asked this question in
Q&A
Replies: 2 comments 1 reply
-
you should use official example for sqlx + tokio (Axum), there should no difference |
Beta Was this translation helpful? Give feedback.
0 replies
-
Did you succeed or you still need help? I have successfully used SQLx with ntex. You can take a look at https://github.com/Nalanda-Labs/N-FERP/ It used 0.7 of ntex which I am upgrading to 1.0 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi guys,
I couldn't find an example of how to integrate with sqlx, so I tried cobbling one together. But I'm unsure this makes sense. Specifically, how different ntex requests can use the same sqlx connection pool.
Similar to the r2d2 integration article here, I tried passing sqlx's connection pool as a parameter into an ntex handler function. But I had to move it, then deref the address (is that even what I'm doing?) .
Sorry for my newbish question, but I have a feeling this isn't the best way, despite it working on my local machine. Here's the code:
https://github.com/mikebelanger/ntex_sqlx_experiment/blob/main/src/main.rs
Any feedback appreciated, thanks!
Beta Was this translation helpful? Give feedback.
All reactions