Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterDatabase ¶
func RegisterDatabase(dbcfg *DatabaseConfig, tc gorp.TypeConverter) (zesty.DB, error)
RegisterDatabase creates a gorp map with tables and tc and registers it with zesty.
Types ¶
type DBMS ¶
type DBMS uint8
DBMS represents a database management system.
Database management systems.
func (DBMS) DriverName ¶
DriverName returns the name of the driver for ds.
type DatabaseConfig ¶
type DatabaseConfig struct { Name string DSN string System DBMS MaxOpenConns int MaxIdleConns int ConnMaxLifetime time.Duration AutoCreateTables bool }
DatabaseConfig represents the configuration used to register a new database.
type TableModel ¶
TableModel is a middleman between a database table and a model type.
func RegisterTableModel ¶
func RegisterTableModel(dbName, tableName string, model interface{}) *TableModel
RegisterTableModel registers a zero-value model to the definition of a database table. If a table model has already been registered with the same table name, this will overwrite it.
func (*TableModel) WithAutoIncrement ¶
func (tb *TableModel) WithAutoIncrement(enable bool) *TableModel
WithAutoIncrement uses enable for table model keys auto-increment.
func (*TableModel) WithKeys ¶
func (tb *TableModel) WithKeys(keys []string) *TableModel
WithKeys uses keys as table keys for the model.