v0.5.0
This release adds the driver arangodb, for ArangoDB 3.12 and its language AQL. It also changes the drivers couchbase, surrealdb, neo4j and influxdb of v0.4.0, and a caller of one of them must read "What changes for a caller" below.
The ArangoDB driver
Import github.com/xo/dbimp/arangodb. It registers the name arangodb, and it takes a DSN of this form:
arangodb://user:password@host:port/database?key=value
The path is the database, and _system without one. The port is 8529 without one. The keys are tls, cancel=tag|none, batch, the size of each batch, and auth=basic|bearer. The secret is always the password of the URL: basic sends it with the user, and bearer sends it as a Bearer token, such as a JWT.
These are the rules that a caller sees:
- A stored document or edge is one column that holds a map. Any other object gives its keys as the columns, and a scalar is one column (D89).
sql.Named("k", v)fills@k, and a positional argument n fills@n. A named argument that the query uses as@@knames a collection. A string or a comment that holds@@kdoes not count (D104).- Each query streams, one batch at a time. When the context ends, or the rows close early, the driver deletes the cursor, or kills the query by a comment that it adds to the query (D90 and D99).
BeginTxbegins a stream transaction that names every collection of the database for write, except the system collections, because ArangoDB needs them before the transaction begins (D91).- The driver takes
CREATEandDROPof collections and indexes, which AQL does not have (D92). A geo index on one field reads GeoJSON (D106).
The tests passed against 3.12.12 as the administrator and as the ordinary user. docs/ARANGODB.md holds what the driver knows about the server, and D89 to D108 in docs/decisions/ hold the reasons.
What changes for a caller
- Neo4j. The comment of
cancel=tagnow ends each statement, on a line of its own, so the position of an error is where the caller wrote it (D95). A rollback now reaches the server after the context ofBeginTxends, so the server frees the locks of the transaction at once (D100). When the rows close before their end, the driver stops a statement that still runs on the server, and in a transaction it reads the rest of the answer, so that the transaction goes on (D105). - InfluxDB. The first column of an InfluxQL result set is
measurement, and notname, soSHOW DATABASESgivesmeasurement | name(D96). - All drivers.
dbimp.ErrIncompletenow means that at least one row of a result set reached the caller before it failed. A failure before the first row, such as a syntax error of Couchbase, no longer wraps it (D107). - SurrealDB.
BeginTxreturnsdbimp.ErrNotSupportedfor every option, and not only for the default ones (D54).
Other changes
- Step 17a of
docs/DRIVER.mdcompares each driver withcouchbasebefore its commit (D97). Two reviews of the whole repository fixed the documents, the comments and the tests that no longer agreed with the code. - Each wire format meets its driver at the row, with a concrete decoder for each format (D108).
- The parser of placeholders in the root package knows the
//comment of AQL,@@name, and a name that starts with a digit.