Skip to content

proposal: database/sql: Check if Tx has already been committed or rolled back #38012

Open
@pjebs

Description

@pjebs

I have a use case where I would like to know if Tx has already been committed or rolledback. I can't track this information myself because it's for a package that is intended to be used by third parties.

Currently I have to perform a "fake" query on the Tx to check if it returns sql.ErrTxDone. This is ok if the transaction has in fact been committed or rolledback. But if it hasn't, then it will actually take time to call the query.

I believe the object internally tracks this information and it would be good if it was exposed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Incoming

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions