aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/lib/pq/connector.go
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net> 2018-07-06 21:18:14 -0700
committerGravatar Frédéric Guillot <fred@miniflux.net> 2018-07-06 21:18:14 -0700
commit459bb4531f92f8663afb6f36aa9be5b789bd591f (patch)
treef14e6c06b8e5c63612d1ff36f8cab40ae8a99d20 /vendor/github.com/lib/pq/connector.go
parent34a3fe426b33a63f2d8e02d4a70c88f137fa5410 (diff)
downloadv2-459bb4531f92f8663afb6f36aa9be5b789bd591f.tar.gz
v2-459bb4531f92f8663afb6f36aa9be5b789bd591f.tar.zst
v2-459bb4531f92f8663afb6f36aa9be5b789bd591f.zip
Update vendor dependencies
Diffstat (limited to 'vendor/github.com/lib/pq/connector.go')
-rw-r--r--vendor/github.com/lib/pq/connector.go43
1 files changed, 43 insertions, 0 deletions
diff --git a/vendor/github.com/lib/pq/connector.go b/vendor/github.com/lib/pq/connector.go
new file mode 100644
index 00000000..9e66eb5d
--- /dev/null
+++ b/vendor/github.com/lib/pq/connector.go
@@ -0,0 +1,43 @@
+// +build go1.10
+
+package pq
+
+import (
+ "context"
+ "database/sql/driver"
+)
+
+// Connector represents a fixed configuration for the pq driver with a given
+// name. Connector satisfies the database/sql/driver Connector interface and
+// can be used to create any number of DB Conn's via the database/sql OpenDB
+// function.
+//
+// See https://golang.org/pkg/database/sql/driver/#Connector.
+// See https://golang.org/pkg/database/sql/#OpenDB.
+type connector struct {
+ name string
+}
+
+// Connect returns a connection to the database using the fixed configuration
+// of this Connector. Context is not used.
+func (c *connector) Connect(_ context.Context) (driver.Conn, error) {
+ return (&Driver{}).Open(c.name)
+}
+
+// Driver returnst the underlying driver of this Connector.
+func (c *connector) Driver() driver.Driver {
+ return &Driver{}
+}
+
+var _ driver.Connector = &connector{}
+
+// NewConnector returns a connector for the pq driver in a fixed configuration
+// with the given name. The returned connector can be used to create any number
+// of equivalent Conn's. The returned connector is intended to be used with
+// database/sql.OpenDB.
+//
+// See https://golang.org/pkg/database/sql/driver/#Connector.
+// See https://golang.org/pkg/database/sql/#OpenDB.
+func NewConnector(name string) (driver.Connector, error) {
+ return &connector{name: name}, nil
+}