Gnorm is a database-first code generator that generates boilerplate that matches your database’s schema.
Gnorm uses templates you control, so that you can make the output look exactly how you want it to look. It can be used to generate type-safe database queries that are faster than a traditional ORM. It can also be used to create a REST or RPC API that exposes the data in your database.
Gnorm reads your database schema, then runs the resulting data through templates you can customize in any way you like to produce code or documentation.
GNORM supports Postgres and MySQL. Further database support is planned for the future. Contributions more than welcome. Check out database/drivers to get an idea of what is involved (it’s not that much).
Databases support a large variety of features, GNORM will add support for more features as time allows, and as needed. If you need a feature, feel free to make an issue (and preferably also a PR).
Gnorm believes that the code should not generate the database schema, but the database schema should generate the code. Schema is declarative, code is imperative, so there’s an inherent mismatch of doing code-first. You end up having to write your schema in special tags or structures purely to generate a schema… when there’s already a langauge to generate a database schema - SQL. Why create a new one? By creating your database schema exactly the way you want it and then generating code to access it, you get the full power of the database, and no hidden costs for what an ORM is doing behind your back.
If you have questions about Gnorm or want to hack on it, meet the devs on the #gnorm channel of gopher slack.