Prefer BeginTx over Begin whenever possible

Ideally we should prefer to use DB.BeginTx over DB.Begin so that we can leverage on automatic rollbacks on context cancellation, and ensure that a transaction commit will fail if the context was already cancelled.

This is especially useful for the API, as we'll likely want to bound database operations with the HTTP request context that's propagated across function calls.

BeginTx also provides us with the ability to enforce a read-only model and custom isolation levels (see https://golang.org/pkg/database/sql/#TxOptions).

Assignee Loading
Time tracking Loading