Gnorm converts your database’s schema into in-memory data structures which you can then feed into your own templates to produce code or documentation or whatever.
Gnorm uses templates you control, so that you can make the output look exactly how you want it to look.
Gnorm can use any templating language, and can generate code or other textual output for any language or system.
It can also be used to create a REST or RPC API that exposes the data in your database. It can be used to generate type-safe database queries that are faster than a traditional ORM. It could even be used to create a yaml configuration for some tool that depends on the database.
Check out how to get started
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.