Trying to understand sqlx::Encode and sqlx::Type #2390
Unanswered
finlaydotb
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So given a stuct like this
and the essential part of using sqlx to bind value of this type
This fails with the following compilation error
so I updated the struct to the following
This now shows the error
Now I updated the struct to
now I get the compilation error
Then finally switching it to below compiles
But if I now change the struct to something like
I started getting errors about
sqlx::Encode
andsqlx::Type
but this timesqlx::Type
does not fix it.So I am trying now to actually take a step back to actually understands these traits and what they do and how to think/use them.
sqlx::Encode
andsqlx::Type
did not work for the tuple new type?String
there is no obvious way to actually store a tuple into the database - so in this case, if I do not want to split the tuple into database columns, how do I save such values? Save it as JSONB? if so how will that be done?Answers will be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions