navigation

SQAC ORM

Sqac is a thin ORM that was written to talk to the SAP Hana in-memory db and other commonly used DBMS systems. The ORM code is simple and can easily be extended to support any database for which a go driver exists.

There are a lot of go-based ORM solutions, so why write a new one?

At the time sqac was written, an ORM solution wasn’t available for the SAP Hana database. I wanted to be able to write an application, test it against a locally installed DBMS like Postgres and then simply ‘re-aim’ the application at SAP Hana without making changes. While it would have been possible to extend an existing ORM solution, I wanted to see what was involved in writing one of my own. Sqac is the result.

Features

  1. Uses go struct tags backed by a user-accessible API to declare database tables.
  2. Struct tags support the declaration of simple and compound indices, foreign-key relationships, primary-keys with starting point, default value, nullable etc.
  3. Supports PostgreSQL, MySQL, Sqlite3, MSSQL & SAP Hana.
  4. Easily extended to support other DB’s via implementation of the PublicDB interface.
  5. API supports common DDL requirements (CREATE, DROP, ALTER etc. for table, indices, sequences etc.).
  6. API supports generic CRUD entity operations.
  7. Set/Get API commands support (/$count /$orderby=field_name $limit=n; $offset=n; ($asc|$desc)).
  8. Access to standard go sql and jmoiron’s sqlx API’s.
  9. A robust test suite is included to ensure correct operation.