go-gorp/gorp

context cannot be passed to DbMap.Begin

MisterSquishy opened this issue · 0 comments

Because DbMap.WithContext returns a SqlExecutor (not a DbMap), it is impossible to set the context on a DbMap without transforming it into a SqlExecutor. This becomes problematic when you want to do something like DbMap.Begin, which is only defined on DbMap and not SqlExecutor.

in practice, this means that DbMap.Begin cannot use an existing context, which means it cannot respect deadlines, which is a real bummer when your connection pool is exhausted 😞

at first glance it seems that WithContext oughta return a DbMap; am I misreading something?