Database Introduction

Interacting with a database is a common requirement for most modern web applications. Traditionally, most frameworks endorse using an ORM (object relational mapper) so that one unified API maybe used on the big four databases.


If you've been in the Go community for a while you'll notice that ORMs are typically frowned upon.


Gozen, honors this philosophy, opting for pure SQL, and prepared statements (to prevent SQL injection attacks)


The big problem with this approach however, is that pure SQL can become quite verbose and error prone to code by hand, in order to circumvent some of these issues Gozen comes with a scaffold builder, which intelligently builds your controller, model and view in one go, for whichever database driver you specify in your .env file. This eliminates the majority of syntax errors, when coding your SQL from scratch. Currently, we have support for:


  • MySQL
  • SQLite
  • PostgreSQL
  • MsSQL


Did you know?

Gozen scaffold generator works for all the four major databases.

Important

Out of the box Gozen already installs the go modules for all four database drivers.