Documentation ¶
Overview ¶
Package database contains functions to simplify opening/closing of DB connections, and tracing of SQL queries
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseDBConnection ¶
CloseDBConnection closes specified database connection.
func CloseSQLConnection ¶
CloseSQLConnection closes the specified database connection.
func OpenDBConnection ¶
OpenDBConnection establishes a connection specified database.
func SetDBOptionsAndPing ¶
SetDBOptionsAndPing configures DB connections and attempts to ping it.
Types ¶
type DBQueryContext ¶ added in v0.3.0
type DBQueryContext struct {
// contains filtered or unexported fields
}
func NewDBSelectContext ¶ added in v0.3.0
func NewDBSelectContext(s *zap.SugaredLogger, conn *sqlx.Conn, trace bool) *DBQueryContext
NewDBSelectContext creates a new instance of the DBQueryContext service.
func (*DBQueryContext) SQLQueryTrace ¶ added in v0.3.0
func (q *DBQueryContext) SQLQueryTrace(query string, args ...interface{})
SQLQueryTrace logs the given SQL query if debug is enabled.
func (*DBQueryContext) SQLResultsTrace ¶ added in v0.3.0
func (q *DBQueryContext) SQLResultsTrace(results interface{})
SQLResultsTrace logs the given SQL result if debug is enabled.
func (*DBQueryContext) SelectContext ¶ added in v0.3.0
func (q *DBQueryContext) SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
SelectContext logs the give query before executing it and the result afterward, if tracing is enabled?