Skip to content

v0.7.0

Choose a tag to compare

@kenshaw kenshaw released this 30 Sep 08:39
· 72 commits to main since this release

This release adds the driver pinot, for Apache Pinot, and gives every driver the Go type that fits the type that its database names. Three drivers change the Go type of some values, so read "What changes for a caller" before you move to it.

New

  • Apache Pinot. The package pinot runs SQL on the Broker of Pinot, measured on 1.4.0 and 1.5.1. The DSN is pinot://user:pass@host:8099, with the keys tls, auth, cancel and engine. The driver takes no write, because the Broker takes none (D128). Each query runs on the multi-stage engine, which returns every row of a query that has no LIMIT, unless engine=single chooses the other (D131). The driver writes each argument into the text as a literal, because the Broker binds none (D132). It cancels a query whose context ends before its answer arrives (D133 and D134).
  • Six types in the root package. dbimp.Date, dbimp.LocalTime, dbimp.OffsetTime, dbimp.LocalDateTime and dbimp.Interval hold a date, a time of day, a time of day with an offset, a date and time with no zone, and an interval of months, days and nanoseconds, which Go has no type for (D138 and D139). Each writes and reads ISO 8601, and is a driver.Valuer of that text. A scan into a *time.Time gives the value in UTC, or in the zone of its offset, and a scan into a *string gives its text. dbimp.Vector[T] is a vector of numbers, which a driver sends as a vector where a plain slice goes as a list.

What changes for a caller

  • Neo4j. A Date, a LocalTime, a Time, a LocalDateTime and a Duration are dbimp.Date, dbimp.LocalTime, dbimp.OffsetTime, dbimp.LocalDateTime and dbimp.Interval, and a Vector is a dbimp.Vector of the type of its coordinates, in both directions. The types neo4j.Date, neo4j.LocalTime, neo4j.Time, neo4j.LocalDateTime, neo4j.Duration and neo4j.Vector are gone. A duration longer than about 292 years is an error.
  • Databend. A Date is a dbimp.Date, where it was a time.Time at midnight in UTC, and an Interval is a dbimp.Interval, where it was the text of the server. A UInt64 is always a uint64, where it was an int64, or an *apd.Decimal above the range of int64. count(*), numbers, nextval and a positive integer literal above the range of an Int32 are each a UInt64, so each is now a uint64. A scan into an *int64 still works. An interval argument with a fraction of a microsecond is an error, because the server drops it. A Vector is a dbimp.Vector[float32], where it was a []float32, and a scan into a *[]float32 still works.
  • Databend geometry. A Geometry and a Geography follow geometry_output_format, at the top of a value and inside an Array, a Map or a Tuple: WKT and EWKT are text, WKB and EWKB are a []byte, and GeoJSON is the decoded JSON value (D136). The driver still asks for WKT.
  • InfluxDB. A Date32 or a Date64 is a dbimp.Date, a Time32 or a Time64 a dbimp.LocalTime, and an Interval a dbimp.Interval, where each was a time.Time or the text of the server. A Duration is a time.Duration. ColumnTypeScanType names T for a nullable column, where it named sql.Null[T] (D136).
  • Couchbase. A value whose JSON kind is not the kind that its signature names is an error, so its Go type is always the scan type (D136). No recording holds one.

Other changes

  • docs/TYPES.md maps every type of every driver onto one list of kinds, and a test writes its table from the product documents (D137). Step 8a of docs/DRIVER.md maps the types of a new driver, with two models, before its code is written.
  • D135 fixes the rule for every driver: a value has the Go type that fits the type that its database names, and a string column gives a string.