Skip to content

v0.8.0

Choose a tag to compare

@kenshaw kenshaw released this 30 Sep 10:22
· 71 commits to main since this release

This release adds the driver rqlite, for rqlite, the distributed database that runs SQLite on each node. No other driver changes.

New

  • rqlite. The package rqlite runs the SQL of SQLite on a node of rqlite over its HTTP API, measured on 9.4.5 and 10.3.6. The DSN is rqlite://user:pass@host:4001, with the keys tls, level and freshness (D141). Each call sends one statement. A query goes to /db/request, so a write with RETURNING returns its rows, and Exec goes to /db/execute (D142). The server binds each argument, positional or named (D143).
  • Types. A value has the Go type of the affinity of its declared type: int64, float64, string, []byte or a number. A BOOLEAN is a bool, a DATE a dbimp.Date, a DATETIME a dbimp.LocalDateTime and a TIMESTAMP a time.Time. SQLite lets a column hold a value of another storage class, and such a value keeps the Go type of its JSON form, such as a string in an INTEGER column (D140).
  • Options. WithTimeout, WithReadonly, WithParameter, WithLevel and WithFreshness apply to one statement. WithReadonly(true) sends the statement to /db/query, which refuses a write, and needs only the permission query. WithDatabase fails, because rqlite has one database.
  • Timeouts. The deadline of the context goes to the server as db_timeout, which stops a read and a write (D145). WithTimeout also ends the request at that time, because 9.4.5 ignores db_timeout for a read on /db/request (D146).

What a caller must know

  • BeginTx fails with dbimp.ErrNotSupported. rqlite runs every write of every client on one connection, so a BEGIN would be open for all of them (D144).
  • RowsAffected and LastInsertId are 0 for a statement that is not INSERT, UPDATE, DELETE, REPLACE or WITH, because the server gives the counts of an earlier write for it (D142).
  • A string argument of the form x'...' goes into the text as a literal, so that it stays text, because the server binds it as a BLOB (D143).
  • The server damages some values before they reach the driver: a BLOB of an expression, and a BLOB in the first row of a column with no declared type, arrive as text, and a DATE, DATETIME or TIMESTAMP whose text does not parse arrives as the year 1. docs/RQLITE.md lists each case.

Other changes

  • The workflow pins dbmeta at f7e3cbb, which starts rqlite with the URL of D141.