Helper functions for generating database stuff.
Note: this is heavily biased toward Postgres
Finds the single row associated with a foreign key in base.
Gets all the children of that type. Specifically, it looks in T for a ForeignKey referencing B and queries on that.
It will return an aggregate row with a member of type of each table in the join.
Returns a given struct populated from the database. Assumes types known to this module.