Skip to content

newbie question #2029

Answered by samtay
aprchen asked this question in Q&A
Aug 8, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

I see a few issues:

  1. The query_as("").fetch_all() expects an executor for executing the query. In your case, you'd pass in a reference to the pool: fetch_all(&session).
  2. DB is a generic type param, you either want to make things generic over DB everywhere or just commit to using MySql as you've done in the session type. For simplicity I think you should just use MySql.
  3. The output type O also needs to be Send and Unpin.
  4. MySql as HasArguments does not implement arguments for str, you'd have to use String.
  5. I don't think mysql will let you bind table names like that unfortunately 😕 . You'll have to manually format the query string using the table name. On the bright side that let's you keep us…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@aprchen
Comment options

Answer selected by aprchen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants