kabb8048
CCConvex Community
•Created by kabb8048 on 3/13/2024 in #general
Custom data types
For anyone in the future reading this, the first step of doing this is checking out the custom-helpers functions. It seems like the convex team has thought of this, but kind of in a more generic way.
Particularly: https://stack.convex.dev/custom-functions
This looks to be exactly what I need so far. Going to keep digging.
4 replies
CCConvex Community
•Created by kabb8048 on 3/13/2024 in #general
Custom data types
Ya, I'm kind of looking for something a little richer than just regex validation - something like the
sql.Valuer
interface for Go. Or fromDatabase(v: string): PlainDate
and toDatabase(v: PlainDate): string
adapters similar to sequelize v7.
https://sequelize.org/docs/v7/other-topics/extending-data-types/
GraphQL has a similar concept with custom scalars:
https://www.apollographql.com/docs/apollo-server/schema/custom-scalars/
Maybe I'll try a proof of concept this weekend to see how it goes.4 replies
CCConvex Community
•Created by kabb8048 on 3/12/2024 in #support-community
Function "versions" / Behavior across deployments
Ya, all makes sense to me, and I agree that function reference is what is wanted. I'm not arguing for a change at all, its just that it wasn't quite clear to me at first. Perhaps there is a line in the docs that says "Convex uses file-based routing similar to Next.js and several other web frameworks where the module a function is defined in and the export symbol it is bound to determine the API path", but I missed it. Just that sentence alone would have cleared it all up for me.
And honestly that's what I would have assumed as well for Convex if it weren't for the list of mind-blowing features that it has ready out of the box. Basically y'all convinced me Convex was magic, so I was looking for more magic.
Anyway, its all clear to me now!
12 replies
CCConvex Community
•Created by kabb8048 on 3/12/2024 in #support-community
Function "versions" / Behavior across deployments
Ya, makes sense - though even that I feel like could use a bit of a deeper explanation on the site.
Like what happens if I schedule a function to run in 15 minutes, but then
convex deploy
removing that function? In other words, am I queuing the function or queueing the function reference? (give your explanation, it certainly feels like they're just the function names, so this isnt'n really something I'm confused at anymore - but just stating that even outside of any application code, this problem exists).
I think the root of my confusion is that convex handles the stable identifiers for my functions, and in traditional web development I am used to being able to change the code name of my API functions (and choose to change or keep the API endpoint). Renaming a function is usually not something that constitutes a breaking API Change, but in Convex it is.12 replies
CCConvex Community
•Created by kabb8048 on 3/12/2024 in #support-community
Function "versions" / Behavior across deployments
OK, makes sense - so if I deploy an updated function named "api.module:functionName", all old clients will automatically start to query the recently deployed function. And if I rename a function from "api.module:functionName" to "api.module:functionName2" then I have essentially broken all clients until they get the updated frontend code.
This could obviously break the "end-to-end typesafety" promise of Convex, but as long as we know the constraints we are operating under we (the developers) can build something robust.
Thanks a ton!
12 replies