Skip to content

How do I abstract a database a database query to a function? #2581

Discussion options

You must be logged in to vote

I'm not entirely sure I understood your question correctly, but if you don't want to move the connection, why not borrowing? You only need a &mut in isin_exists so no need to move the value at all:

pub async fn isin_exists(isin: &String, db: &mut Connection<GhostfolioDB>) -> bool

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by SergioBenitez
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants