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...
Published at
2023-11-10 18:37:37Event JSON
{
"id": "ad2303bcb392b0c7670b105b0d29df7e5dcd49ba380a910f7ad5d3090b5815a6",
"pubkey": "79c16d9c318f770b262a163ddc7d2c8c449ff553f4bec786d8479ebf207dfd4d",
"created_at": 1699641457,
"kind": 1,
"tags": [
[
"p",
"c81171b73f7112553ec8ba1dfdda4cce82b44e448c8560a58696f7285eb9d9e3",
"wss://relay.mostr.pub"
],
[
"p",
"5bdfe5c3188a24f76efd37648930d8ada3e458961d03b2e0d62596d4f76e4778",
"wss://relay.mostr.pub"
],
[
"e",
"66f8b2eaae5cb59471fb16c0a4ed1f33490cb9afcc4f5e13f4a45f8888478f9f",
"wss://relay.mostr.pub",
"reply"
],
[
"proxy",
"https://mamot.fr/users/corpsmoderne/statuses/111387702540370665",
"activitypub"
]
],
"content": "nostr:npub1eqghrdelwyf920kghgwlmkjve6ptgnjy3jzkpfvxjmmjsh4em83sq6fncn my use case looks more like this:\n\nasync fn get_user_messages();\nasync fn get_last_ten_public_messages();\n\nThe first query will look like:\nSELECT {{10 fields}} FROM messages WHERE user = $1;\n\nWhile the second will look like:\nSELECT {{10 fields}} FROM messages WHERE public = True ORDER BY id DESC LIMIT 10\";\n\nIf 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...",
"sig": "b8f1fd325ed7aba653439b718e380d1d1d8f60f9a8083b428f9b5062aee34034c0c2d1c2f6f699c68f89e9c00c49ee7ae0f94eef63dd6fd5af5f63d8e0e7e6ba"
}