Beispiel #1
0
func (c MonitoredStmt) Query(args []driver.Value) (driver.Rows, error) {
	var rows driver.Rows
	var err error
	duration := monitor.Duration(func() {
		rows, err = c.delegate.Query(args)
	})

	c.monitorFunc.OnEvent(MonitorResult{
		Description: c.query,
		Duration:    duration,
	})

	return rows, err
}
Beispiel #2
0
func (c MonitoredStmt) Exec(args []driver.Value) (driver.Result, error) {
	var result driver.Result
	var err error
	duration := monitor.Duration(func() {
		result, err = c.delegate.Exec(args)
	})

	c.monitorFunc.OnEvent(MonitorResult{
		Description: c.query,
		Duration:    duration,
		Args:        args,
	})

	return result, err
}