Hi everybody :)
tldr. gosqlgen is a SQL code and test code generator from struct tag annotations.
I am just sharing a little project I worked on. It is nothing groundbreaking, but it kind of solved an issue I had for my projects. At work and also on home projects I usually model my database layer around struct types representing the database tables. I found it tedious to always re-implement the basic crud methods, especially if I am in the exploratory phase of the project. gosqlgen helps by automatically generating not just code but also tests.
For now, I only decided to implement just the 4 basic crud methods, with support for soft deletes and business key columns (aka unique constraints). Th…
Hi everybody :)
tldr. gosqlgen is a SQL code and test code generator from struct tag annotations.
I am just sharing a little project I worked on. It is nothing groundbreaking, but it kind of solved an issue I had for my projects. At work and also on home projects I usually model my database layer around struct types representing the database tables. I found it tedious to always re-implement the basic crud methods, especially if I am in the exploratory phase of the project. gosqlgen helps by automatically generating not just code but also tests.
For now, I only decided to implement just the 4 basic crud methods, with support for soft deletes and business key columns (aka unique constraints). The generated methods are unexported. This is intentional, so the user is forced to export only what is necessary.
I think the best usecase for this is when you have a new project and just want to quickly implement all the methods for your tables (of course you can just use AI :D I just like predictable generators).
Have a nice rest of the day :)