Documentation ¶
Index ¶
- Variables
- func Connect(cfg Config) (*sql.DB, error)
- func Connected(db *sql.DB) error
- func Downgrade(path, driver string, db *sql.DB) error
- func MustConnect(cfg Config) *sql.DB
- func RecordQueryError(name string)
- func RecordQuerySuccess(name string)
- func Rollback(tx *sql.Tx)
- func Upgrade(path, driver string, db *sql.DB) error
- type Config
- type MysqlConfig
- type QueryTimer
- type SqliteConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMigrationsFailed = errors.New("database migrations failed") ErrNotConnected = errors.New("not connected to database") )
Common errors
Functions ¶
func MustConnect ¶
MustConnect establishes and tests a new database connection, and panics on errors.
func RecordQueryError ¶
func RecordQueryError(name string)
RecordQuerySuccess records the execution of a named query as failed
func RecordQuerySuccess ¶
func RecordQuerySuccess(name string)
RecordQuerySuccess records the execution of a named query as successfull
Types ¶
type MysqlConfig ¶
type MysqlConfig struct { Protocol string `json:"protocol"` Host string `json:"host"` Port string `json:"port"` User string `json:"username"` Password string `json:"password"` Database string `json:"database"` ConnectionParams string `json:"connectionParams"` }
MysqlConfig configuration info for a MySQL databse.
func (MysqlConfig) Driver ¶
func (cfg MysqlConfig) Driver() string
Driver gets the SQLite driver name.
type QueryTimer ¶
type QueryTimer struct { QueryName string // contains filtered or unexported fields }
QueryTimer struct to keep track of a queries execution time.
func NewQueryTimer ¶
func NewQueryTimer(name string) QueryTimer
func (QueryTimer) Stop ¶
func (t QueryTimer) Stop()
type SqliteConfig ¶
SqliteConfig configuration info for a SQLite databse.
func (SqliteConfig) Driver ¶
func (cfg SqliteConfig) Driver() string
Driver gets the SQLite driver name.
Click to show internal directories.
Click to hide internal directories.