( ctx context.Context, fn func(context.Context, *pool.Conn) error, )
| 812 | } |
| 813 | |
| 814 | func (c *baseClient) withConn( |
| 815 | ctx context.Context, fn func(context.Context, *pool.Conn) error, |
| 816 | ) error { |
| 817 | cn, err := c.getConn(ctx) |
| 818 | if err != nil { |
| 819 | return err |
| 820 | } |
| 821 | |
| 822 | var fnErr error |
| 823 | defer func() { |
| 824 | c.releaseConn(ctx, cn, fnErr) |
| 825 | }() |
| 826 | |
| 827 | fnErr = fn(ctx, cn) |
| 828 | |
| 829 | return fnErr |
| 830 | } |
| 831 | |
| 832 | func (c *baseClient) dial(ctx context.Context, network, addr string) (net.Conn, error) { |
| 833 | return c.opt.Dialer(ctx, network, addr) |
no test coverage detected