sqlite
sqlite copied to clipboard
sqlitepool: new package, implements a pool
This is intended as a replacement for our internal sqlitedb package pool and its TxWrapper.
It needs a little more machinery to be dropped in that's not covered in this PR, in particular:
- helper functions that mimic ExecContext/QueryContext/QueryRowContext to make replacing the existing uses of TxWrappers easy
- a little more Tracer plumbing, so we can get SQL query exec times out in the same format we are used to them now
- a few other missing counters
This PR implements the Tx/Rx object split we've discussed a few times. It will take a bit of work to make good use of that internally. But I figured it's worth getting in now.
After we've replaced the current pool, I plan to have the code generator for queries work directly on top of this pool.
Any other features you want to see in a pool?
This PR now includes a second commit filled with basic implementations of the Exec/QueryRow/Query, like database/sql
.
Long-term I'm hoping to replace these with generated access to statements (like sqlc, but without the allocations), but this lets us get sqlitepool into our server with mostly-mechanical perl one-liners.
Ready for review.
See it in action here: https://github.com/tailscale/corp/pull/5720