Marc Planard on Nostr: npub1eqghr…6fncn my use case looks more like this: async fn get_user_messages(); ...
npub1eqghrdelwyf920kghgwlmkjve6ptgnjy3jzkpfvxjmmjsh4em83sq6fncn (npub1eqg…fncn) my use case looks more like this:
async fn get_user_messages();
async fn get_last_ten_public_messages();
The first query will look like:
SELECT {{10 fields}} FROM messages WHERE user = $1;
While the second will look like:
SELECT {{10 fields}} FROM messages WHERE public = True ORDER BY id DESC LIMIT 10";
If I have to add a eleventh field to my struct, I'll have to fix all my queries which is the opposite of DRY. I don't see how to handle that in a single query with sqlx...
async fn get_user_messages();
async fn get_last_ten_public_messages();
The first query will look like:
SELECT {{10 fields}} FROM messages WHERE user = $1;
While the second will look like:
SELECT {{10 fields}} FROM messages WHERE public = True ORDER BY id DESC LIMIT 10";
If I have to add a eleventh field to my struct, I'll have to fix all my queries which is the opposite of DRY. I don't see how to handle that in a single query with sqlx...