Skip to content

v0.9.0

Choose a tag to compare

@kenshaw kenshaw released this 30 Sep 21:02
· 67 commits to main since this release

This release adds the driver libsql, for libSQL and Turso, which serve SQLite over the Hrana protocol. No other driver changes for a caller.

New

  • libSQL and Turso. The package libsql runs SQL on sqld, the libSQL server, and on Turso Cloud, measured on sqld 0.24.33. The DSN is libsql://user:token@host:port, with the keys tls, auth and namespace (D148). TLS is on by default, and a DSN with tls=false names its port. The token goes as Authorization: Bearer, and auth=basic sends basic authentication for sqld with SQLD_HTTP_AUTH. dburl names turso as an alias (D76).
  • Reading. A query reads its rows from /v3/cursor one entry at a time, with no cap on the size, where a pipeline stops at 10MB. The driver closes the stream of the cursor after its rows. An error after some rows wraps dbimp.ErrIncomplete (D149).
  • Transactions. BeginTx sends BEGIN on a stream, which its baton holds across requests. A stream with no statement for 10 seconds expires, the server rolls back its transaction, and the next statement says so. ReadOnly and any isolation level but the default fail with dbimp.ErrNotSupported, because the server keeps no transaction read-only (D150).
  • Types. A value has the Go type of the affinity of its declared type, as for rqlite, and a value of another storage class keeps its own Go type. A BOOLEAN is a bool, a DATE a dbimp.Date, a DATETIME a dbimp.LocalDateTime, a TIMESTAMP a time.Time, and an F32_BLOB a dbimp.Vector[float32]. The server sends an infinity with no sign, so it reads as +Inf, and CAST(x AS TEXT) in the statement keeps the sign (D147).
  • Arguments. The server binds each argument as a typed value, positional or named, but not both in one statement (D152).
  • Options. WithTimeout, WithParameter, WithDatabase and WithNamespace apply to one statement. WithTimeout ends the request, and the server stops the statement when its client leaves. WithReadonly(true) fails, because the server cannot keep a statement read-only.

Other changes

  • The rules of affinity of SQLite are in the root package, as dbimp.Affinity and dbimp.AffinityOf, and the rqlite driver uses them. Its behavior does not change.
  • The workflow pins dbmeta at a59c0c1, which runs sqld with a token that can write and a token that can only read.