gorp transactions are created with nil options, which means that all Tx use the driver's default isolation level.
For InnoDB, this level is REPEATABLE READ, which is a pretty loose guarantee.
If there was a method to start a transaction with a given isolation level, my team could avoid doing a fair amount of SELECT ... FOR UPDATE and use the included Get() methods within an isolated transaction.
I know gorp supports optimistic locking with a version column, but we don't use this at my job, and supporting the standard library's options could be nice.
Something like:
func (d *DbMap) BeginOption(option *sql.TxOptions) (*Transaction, error) {
}
gorp transactions are created with
niloptions, which means that all Tx use the driver's default isolation level.For InnoDB, this level is
REPEATABLE READ, which is a pretty loose guarantee.If there was a method to start a transaction with a given isolation level, my team could avoid doing a fair amount of
SELECT ... FOR UPDATEand use the includedGet()methods within an isolated transaction.I know gorp supports optimistic locking with a version column, but we don't use this at my job, and supporting the standard library's options could be nice.
Something like: