Open
Description
Incus uses a built-in code generator for most of its database interactions.
Unfortunately not all entities have yet been moved over to that mechanism, causing us to have far more SQL code in our code tree than we'd really like.
The goal here is to define new code generated functions in internal/server/db/cluster/
and then remove the old implementation from internal/server/db/
transitioning everything over to the new generated functions.
A recent example of the database generator being used can be found here:
#655
Note that some of the syntax has since evolved, so you may want to look at the current version of networks_integrations.go
to see how to invoke the generator.