db
db copied to clipboard
upper/v4: consider exposing SetTxOptions
One property we relied in the forked pressly bond was the ability to set the sql.TxOptions. This has saved us a few times where we explicitly wanted to treat the entire session as read-only.
I see the only place this can be set explicitly is through the upper API is:
TxContext(ctx context.Context, fn func(sess Session) error, opts *sql.TxOptions) error
But, it'd be useful if the SetTxOptions were exposed publicly, something like:
sess, err = postgresql.Open(conn)
if err != nil {
// ..
}
sess.SetTxOptions(...)
This would apply to the sqladapter.session but be treated as a nop for the other impl.
Alternatively, it could also reside on the Settings interface .. not sure though.
sounds like a good idea. can you guys submit a PR?