gnormal / gnorm

A database-first code generator for any language
https://gnorm.org
Other
488 stars 40 forks source link

Adds Primary Key Information To Tables and Columns #50

Closed daniel-reed closed 6 years ago

daniel-reed commented 6 years ago

PrimaryKeys are stored in the data.Table as a slice of columns. PrimaryKey is stored in the data.Column as a bool. This allows for easy iteration in template building of all primary key columns of a table.

For Postgres, a new query has been written as queryPrimaryKeys to get the required information. With the required Joins, this could not be done using Gnorm generated types at this time.

For Mysql, the primary key data was already available through the COLUMN_KEY field.

natefinch commented 6 years ago

Wow, somehow missed this. I'll review tonight if I can.

natefinch commented 6 years ago

And thanks! :)