Example #1
0
// AttachSQLAdapter - Helper func designed to create and attach (but not start)
// mysql adapter. Additionally this is a DRY attempt to make sure code is as organized
// as possible.
func (bs *BridgeService) AttachSQLAdapter(n string, c map[string]interface{}) (err error) {
	bs.Info("Setting up (service: %s) mysql database (adapter: %s)...", bs.Name(), n)

	var adapter mysql.Adapter

	if adapter, err = mysql.NewAdapter(n, c, bs.Logger); err != nil {
		return
	}

	bs.Connections.Attach(adapter.Name(), adapter)

	return
}