Now that I have a database library I like, I start cleaning up the code. The got some good tips from the main Hasql developer Nikita Volkov, and I implement many of them here.
The basic idea is to create a Hasql module for each SQL query to get the right level of encapsulation for the Hasql library. There are a few things that I could do to clean things up more. For example, I could create custom Hasql Params and Results types of each statement, so that I can modify the SQL queries without needing to change the types of Statement and Session objects. I don't do that here only because I'm using protocol buffers as the primary data type and I'm still trying to figure out how I want that to work with the database layer.
Special thanks to Frederick Rowland for being my first ever Patreon Patron! You can join my Patreon at https://patreon.com/ants_are_everywhere.
Thanks for watching :)
Discord: https://discord.gg/YNtU8Yw7yT
Mastodon: https://mathstodon.xyz/@ants_are_everywhere
3 Comments