Typed Errors
#3228
Replies: 1 comment
-
The current approach is relying on the pq driver: pqError, ok := err.(*pq.Error)
if ok && pqError.Code == ERROR_CODE_LOCK_NOT_AVAILABLE {
return nil, &ConcurrentUpdateError{}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm using
SELECT FOR UPDATE NOWAIT
for locking a row and preventing concurrent updates. When a concurrent transaction tries to select the same row that's been locked by another transaction for update, I'd like to return a different error code to the client as opposed to the generic internal server failure that is returned for any other failure. Is there a way to achieve that in sqlc ? Does the generated queries go code return a different type of error for this case ?Beta Was this translation helpful? Give feedback.
All reactions