Documentation ¶
Index ¶
- type CounterHook
- func (h *CounterHook) CommittedTxs() int
- func (h *CounterHook) ConnClosed(err error)
- func (h *CounterHook) ConnErrs() int
- func (h *CounterHook) ConnOpened(err error)
- func (h *CounterHook) ExecErrs() int
- func (h *CounterHook) Execed(d time.Duration, query string, err error)
- func (h *CounterHook) Execs() int
- func (h *CounterHook) OpenConns() int
- func (h *CounterHook) OpenStmts() int
- func (h *CounterHook) OpenTxs() int
- func (h *CounterHook) Queried(d time.Duration, query string, err error)
- func (h *CounterHook) Queries() int
- func (h *CounterHook) QueryErrs() int
- func (h *CounterHook) RolledbackTxs() int
- func (h *CounterHook) RowErrs() int
- func (h *CounterHook) RowIterated(err error)
- func (h *CounterHook) RowsIterated() int
- func (h *CounterHook) StmtClosed(err error)
- func (h *CounterHook) StmtErrs() int
- func (h *CounterHook) StmtPrepared(query string, err error)
- func (h *CounterHook) TotalConns() int
- func (h *CounterHook) TotalStmts() int
- func (h *CounterHook) TotalTxs() int
- func (h *CounterHook) TxBegan(err error)
- func (h *CounterHook) TxCloseErrs() int
- func (h *CounterHook) TxCommitted(err error)
- func (h *CounterHook) TxOpenErrs() int
- func (h *CounterHook) TxRolledback(err error)
- type Driver
- type Hook
- type OpenFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CounterHook ¶
type CounterHook struct {
// contains filtered or unexported fields
}
CounterHook is a Hook that keeps counters of various stats with respect to database usage.
func (*CounterHook) CommittedTxs ¶
func (h *CounterHook) CommittedTxs() int
CommittedTxs returns the total number of transactions that were committed.
func (*CounterHook) ConnClosed ¶
func (h *CounterHook) ConnClosed(err error)
ConnClosed implements ConnClosed of the Hook interface.
func (*CounterHook) ConnErrs ¶
func (h *CounterHook) ConnErrs() int
ConnErrs returns the number of errors encountered trying to open a connection.
func (*CounterHook) ConnOpened ¶
func (h *CounterHook) ConnOpened(err error)
ConnOpened implements ConnOpened of the Hook interface.
func (*CounterHook) ExecErrs ¶
func (h *CounterHook) ExecErrs() int
ExexErrs returns the number of errors encountered trying to exec command.
func (*CounterHook) Execed ¶
func (h *CounterHook) Execed(d time.Duration, query string, err error)
Execed implements Execed of the Hook interface.
func (*CounterHook) Execs ¶
func (h *CounterHook) Execs() int
Execs returns the total number of Exex statements ran.
func (*CounterHook) OpenConns ¶
func (h *CounterHook) OpenConns() int
OpenConns returns the current count of open connections.
func (*CounterHook) OpenStmts ¶
func (h *CounterHook) OpenStmts() int
OpenStmts returns the current count of prepared statements.
func (*CounterHook) OpenTxs ¶
func (h *CounterHook) OpenTxs() int
OpenTxs returns the current number of open transactions
func (*CounterHook) Queried ¶
func (h *CounterHook) Queried(d time.Duration, query string, err error)
Queried implements Queried of the Hook interface.
func (*CounterHook) Queries ¶
func (h *CounterHook) Queries() int
Queries returns the total number of Query statements ran.
func (*CounterHook) QueryErrs ¶
func (h *CounterHook) QueryErrs() int
QueryErrs returns the number of errors encountered trying to run a query.
func (*CounterHook) RolledbackTxs ¶
func (h *CounterHook) RolledbackTxs() int
RolledbackTxs returns the total number of transactions there were rolled back.
func (*CounterHook) RowErrs ¶
func (h *CounterHook) RowErrs() int
RowErrs returns the number of error encountered while iterating rows.
func (*CounterHook) RowIterated ¶
func (h *CounterHook) RowIterated(err error)
RowIterated implements RowIterated of the Hook interface.
func (*CounterHook) RowsIterated ¶
func (h *CounterHook) RowsIterated() int
RowsIterated returns the total number of rows that have been iterated through.
func (*CounterHook) StmtClosed ¶
func (h *CounterHook) StmtClosed(err error)
StmtClosed implements StmtClosed of the Hook interface.
func (*CounterHook) StmtErrs ¶
func (h *CounterHook) StmtErrs() int
StmtErrs returns the number of errors encountered trying to prepare a statement.
func (*CounterHook) StmtPrepared ¶
func (h *CounterHook) StmtPrepared(query string, err error)
StmtPrepared implements StmtPrepared of the Hook interface.
func (*CounterHook) TotalConns ¶
func (h *CounterHook) TotalConns() int
TotalConns returns the total number of connections ever made.
func (*CounterHook) TotalStmts ¶
func (h *CounterHook) TotalStmts() int
TotalStmts returns the total number of prepared statements ever made.
func (*CounterHook) TotalTxs ¶
func (h *CounterHook) TotalTxs() int
TotalTxs returns the total number of transactions ever openned.
func (*CounterHook) TxBegan ¶
func (h *CounterHook) TxBegan(err error)
TxBegan implements TxBegan of the Hook interface.
func (*CounterHook) TxCloseErrs ¶
func (h *CounterHook) TxCloseErrs() int
TxCloseErrs returns the number of errors encountered trying to Commit or Rollback a transacttion.
func (*CounterHook) TxCommitted ¶
func (h *CounterHook) TxCommitted(err error)
TxCommitted implements TxCommitted of the Hook interface.
func (*CounterHook) TxOpenErrs ¶
func (h *CounterHook) TxOpenErrs() int
TxOpenErrs returns the number of errors encountered trying to start a transaction.
func (*CounterHook) TxRolledback ¶
func (h *CounterHook) TxRolledback(err error)
TxRolledback implements TxRolledback of the Hook interface.
type Driver ¶
type Hook ¶
type Hook interface { ConnOpened(err error) ConnClosed(err error) StmtPrepared(query string, err error) StmtClosed(err error) TxBegan(err error) TxCommitted(err error) TxRolledback(err error) Queried(d time.Duration, query string, err error) Execed(d time.Duration, query string, err error) RowIterated(err error) }
Hook is an interface through which database events can be received. A Hook may received multiple events concurrently. Each function's last argument is of type error which will contain an error encountered while trying to perform the action. The one exception is RowInterated which will not return io.EOF because it is an expected return value.