Closed haaawk closed 1 year ago
Even when someone takes a single db connection and makes concurrent requests to it - everything works because the execution is under a lock -> https://github.com/golang/go/blob/master/src/database/sql/sql.go#L1670-L1676 I added an example of that too.
I initially thought that I will have to implement support for matching request id in request and response but it seems that it won't be necessary. Next thing I will do is implementation of interactive transactions and maybe then it will turn out the connection can be used concurrently. But until then it seems to be no reason to complicate the code.
I'm merging this. Will clean up the parsing code in later PRs
It actually turns out that Golang sql framework does not send requests concurrently on a connection so current code works even when concurrent goroutines are accessing the db. I added a test for that.