How do we store/query data when using Roc?
roc-pg is the only existing database driver
Though people have also used the sqlite cli via sub processes
I am wondering what would be easier: to create native database connectors, like roc-pg
or to use something like libpg wrappers or some ready to use C/C++ connectors?
We recently included sqlite in basic-webserver, that may be the most convenient way.
Forking a platform and wrapping another library is probably the easiest to get started.
here is an example of the sqlite on action. I like this example for how I parse the rows and handle errors.
Forking a platform looks like a workaround, or is it The Way®™?
for something like this, I'd say:
roc-pg
does, should be the best user experience and doesn't require forking anything.so it really depends on what your goals are - get the application working quickly, or make an investment in the ecosystem? Either is totally reasonable, depending on your priorities! :smiley:
Is there any long-term plan for a 3rd option which would not require forking a platform and also not having to implement an integration from scratch? I don't know what would that be, like a… plugin for a platform?
in the specific case of a database client, I think the optimal long-term plan is to implement them in Roc like how roc-pg
does it
it's the simplest, the safest, and the most portable
the only downside is that it has to actually be implemented :big_smile:
which is why it's the best long-term but maybe not in the immediate term depending on what you're building!
Implementing is not the hard part. The hard part is to keep it up to date and follow all the new features. It might be a real problem for Roc – I can see how much a problem it's sometimes in languages with much larger community like F#, where implementing a PG library is just a thin wrapper around Dotnet/C# and even though it lags behind very often.
As I said, implementing something like a full featured database (or RabbitMQ) driver is seems like the easy part, the long-term maintenance is hell, because very often the founder is no longer paying attention.
At the end of a day, a F# team can take a desperate measure and just switch to a C# library. For Roc, the equivalent would be to switch to C/C++/Rust/Zig/whatever C-like and go from there instead.
I don't think we should take it as a given that in the long term Roc's community will be small; in fact, I assume the opposite :big_smile:
I appreciate that database clients are not simple projects, but I don't think that changes the fact that it's simplest, safest, and most portable to do it in Roc
the most popular C# pg client is 100% C#, and the most popular Java pg client is 100% Java.
same for Go
maybe there was a time when these were C wrappers (C# and Java were both small communities once, too, and certainly Go is smaller than either) but clearly it's realistic to implement database clients without wrapping existing drivers in other languages, and I think when we're talking about the long term we should plan for doing what's best! :smiley:
Last updated: Jul 06 2025 at 12:14 UTC