MCPcopy Index your code
hub / github.com/coder/coder / Connect

Method Connect

coderd/database/dbtestutil/driver.go:21–41  ·  view source on GitHub ↗
(_ context.Context)

Source from the content-addressed store, hash-verified

19}
20
21func (c *Connector) Connect(_ context.Context) (driver.Conn, error) {
22 if c.dialer != nil {
23 conn, err := pq.DialOpen(c.dialer, c.name)
24 if err != nil {
25 return nil, xerrors.Errorf("failed to dial open connection: %w", err)
26 }
27
28 c.driver.Connections <- conn
29
30 return conn, nil
31 }
32
33 conn, err := pq.Driver{}.Open(c.name)
34 if err != nil {
35 return nil, xerrors.Errorf("failed to open connection: %w", err)
36 }
37
38 c.driver.Connections <- conn
39
40 return conn, nil
41}
42
43func (c *Connector) Driver() driver.Driver {
44 return c.driver

Callers 1

ConnectMethod · 0.95

Calls 2

ErrorfMethod · 0.45
OpenMethod · 0.45

Tested by

no test coverage detected