-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstack_trace_connection_pool.go
38 lines (30 loc) · 1.13 KB
/
stack_trace_connection_pool.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package sqldb
import "context"
type StackTraceConnectionPool struct {
inner ConnectionPool
*StackTrace
}
func NewStackTraceConnectionPool(inner ConnectionPool) *StackTraceConnectionPool {
return &StackTraceConnectionPool{inner: inner}
}
func (this *StackTraceConnectionPool) Ping(ctx context.Context) error {
return this.Wrap(this.inner.Ping(ctx))
}
func (this *StackTraceConnectionPool) BeginTransaction(ctx context.Context) (Transaction, error) {
if tx, err := this.inner.BeginTransaction(ctx); err == nil {
return NewStackTraceTransaction(tx), nil
} else {
return nil, this.Wrap(err)
}
}
func (this *StackTraceConnectionPool) Close() error {
return this.Wrap(this.inner.Close())
}
func (this *StackTraceConnectionPool) Execute(ctx context.Context, statement string, parameters ...interface{}) (uint64, error) {
affected, err := this.inner.Execute(ctx, statement, parameters...)
return affected, this.Wrap(err)
}
func (this *StackTraceConnectionPool) Select(ctx context.Context, query string, parameters ...interface{}) (SelectResult, error) {
result, err := this.inner.Select(ctx, query, parameters...)
return result, this.Wrap(err)
}