Skip to content

Support sql.IsolationLevel for transactions #428

Open
@joeblubaugh

Description

@joeblubaugh

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) {

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions