Kyle
CCConvex Community
•Created by Kyle on 3/19/2024 in #show-and-tell
Rust Macro: convex_model!
You set
proc-macro = true
in Cargo.toml, and then export a proc-macro function in src/lib.rs.
Not very familiar with macro development myself, but this workshop and youtube video had some good examples to follow:
- proc-macro-workshop
- Jon streaming implementing the workshop10 replies
CCConvex Community
•Created by Kyle on 3/19/2024 in #show-and-tell
Rust Macro: convex_model!
Yeah the nested stuff can be annoying, parsing it into an intermediate structure I didn't find too bad. Here's the code I have for that:
- The final ConvexField struct
- Parsing entry point
- Main parsing logic
10 replies
CCConvex Community
•Created by Kyle on 3/19/2024 in #show-and-tell
Rust Macro: convex_model!
That's a cool project! I'm definitely thinking about how to make the query/mutation/action part integrated with rust better too, will be taking a look at your examples
10 replies
CCConvex Community
•Created by Kyle on 3/19/2024 in #show-and-tell
Rust Macro: convex_model!
Nice, i'll check it out
10 replies
CCConvex Community
•Created by Kyle on 3/13/2024 in #support-community
Mark argument as sensitive to avoid printing it during errors?
Ah, that's a great point. I'm more concerned about them showing up to the end users via error messages (and them losing trust in security by seeing secrets in plaintext). If these messages don't show up in prod then I think that prevents the issue, all this was happening on the dev environment with dev keys.
7 replies
CCConvex Community
•Created by Kyle on 3/13/2024 in #support-community
Mark argument as sensitive to avoid printing it during errors?
Yeah it would be helpful, kind of like how terraform allows you to mark variables as sensitive, or how github actions automatically hides secrets that get logged (although I doubt you can do anything automatically for arbitrary args)
7 replies
CCConvex Community
•Created by Kyle on 2/17/2024 in #support-community
Can you force the return of a handler when defining a custom query?
I did try that at first; I believe I was running into problems with my setup with triggering boundaries while things were in a loading state. Like the first pass UserIdentity would be undefined or something and trigger the thrown convex error. That was a lot more annoying to deal with
6 replies
CCConvex Community
•Created by Kyle on 2/17/2024 in #support-community
Can you force the return of a handler when defining a custom query?
Perfect thanks for the example, that's roughly what I got my way to, but was having trouble getting the types to pass
6 replies
CCConvex Community
•Created by Kyle on 2/16/2024 in #show-and-tell
Example Utility for Joining between Tables
The other improvement I noticed is if the
id
field doesn't map to the table names it breaks down. i.e. if you have authorId
which points to a user instead of a userId
then the mapping won't find Doc<"author">
, it should be looking for Doc<"user">
. (And similar issue if you use plural table name convention instead of singular)4 replies
CCConvex Community
•Created by Kyle on 2/16/2024 in #show-and-tell
Example Utility for Joining between Tables
@ian here's the post; I think you're right about being able to get rid of the the type params. I tried to do it by leveraging the field that's provided and mapping it to the JoinTable type, and then you have the items for the BaseTable type, but something wasn't quite working so I forced them to be provided and moved on 🙂
4 replies