Created
November 26, 2021 16:35
-
-
Save agusrichard/1792b991a817282f07ecc10627daef72 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tx, err := r.db.Beginx() | |
if err != nil { | |
return errors.Wrap(err, "todo repository: create todo: failed to initiate transaction;") | |
} | |
err = insertTodo(tx, todo) | |
if err != nil { | |
tx.Rollback() | |
return errors.Wrap(err, "todo repository: create todo: failed to insert todo in repository;") | |
} | |
tx.Commit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment