Replies: 1 comment
-
I guess for flexibility the really important question here is by me marshalling values through a function and using query! macro vs. just using query_as! macro, do I suffer a performance hit? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In mysql I have a field with the following definition
| type | enum('REGION','LOCATION','SITE') | NO | | REGION | |
Now in my rust enum (derived from protobuf) it sees that value should be an i32. When you query it with CAST(type+0) as SIGNED, it comes back as an i64. Therefore when doing queryas! macro I get the following
"the trait From is not implemented for i32, which is required by
i64: Into<>
" . I get the reasoning behind it, my question though: is there anyway to work around it. I have two ideas I'm not pro on, one is to make thefield and integer or medium int and just store the number, the other is to just use the query! macro and then send to a function that marshals Record to my Struct. On the latter idea, I am worried about a performance hit, but I
imagine if I could use query_as! macro, it is marshaling anyway, so it is the same hit?
Beta Was this translation helpful? Give feedback.
All reactions