tursodatabase / libsql-client-go

Go client API for libSQL
MIT License
180 stars 24 forks source link

Initial version of websockets support #1

Closed haaawk closed 1 year ago

haaawk commented 1 year ago

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.

haaawk commented 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.

haaawk commented 1 year ago

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.

haaawk commented 1 year ago

I'm merging this. Will clean up the parsing code in later PRs