Specify output for query_as! #1646
-
|
How can I specify the output type of a |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
This also occurs with something like expecting a bool but getting a tinyint when specifying a struct. |
Beta Was this translation helpful? Give feedback.
-
|
You can also use |
Beta Was this translation helpful? Give feedback.
query_as!supports the same type override syntax asquery!: https://docs.rs/sqlx/latest/sqlx/macro.query.html#type-overrides-output-columnsYou can also use
foo as "foo: _"to have the type inferred from the corresponding field in the struct (it'll still be checked for compatibility at runtime).