aboutsummaryrefslogtreecommitdiff
path: root/internal/database/driver.go
AgeCommit message (Collapse)Author
2021-03-25internal/database: wrap OpenCensus sql driverJonathan Amsterdam
The datbase/sql package provides a way to get at the underlying driver's connection. We will need that feature to access pgx's fast CopyFrom method. Unfortunately, we do not use the pgx driver directly. Instead, we wrap it in an OpenCensus driver for tracing and metrics. And that OpenCensus driver's connection does not allow us to dig into _it_ to retrieve the pgx connection that it wraps. Hence this dance: we must write our own driver and connection implementations. The driver return the connection, and the connection holds both the underlying (pgx) connection and the OpenCensus connection, to which it delegates. This CL is a no-op; everything behaves as before. But it lays the groundwork for a subsequent CL that will use pgx's CopyFrom. Change-Id: I5bf308aa23f07f20d1f6410ebb04cd6b9a5e0922 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/304630 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>