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

Function Open

coderd/database/dbtestutil/postgres.go:175–182  ·  view source on GitHub ↗

Open creates a new PostgreSQL database instance. If there's a database running at localhost:5432, it will use that. Otherwise, it will start a new postgres container.

(t TBSubset, opts ...OpenOption)

Source from the content-addressed store, hash-verified

173// If there's a database running at localhost:5432, it will use that.
174// Otherwise, it will start a new postgres container.
175func Open(t TBSubset, opts ...OpenOption) (string, error) {
176 t.Helper()
177 params, err := DefaultBroker.Create(t, opts...)
178 if err != nil {
179 return "", err
180 }
181 return params.DSN(), nil
182}
183
184// createDatabaseFromTemplate creates a new database from a template database.
185// If templateDBName is empty, it will create a new template database based on

Callers 15

testSQLDBFunction · 0.92
TestOpenFunction · 0.92
TestOpen_InvalidDBFromFunction · 0.92
TestOpen_ValidDBFromFunction · 0.92
TestOpen_PanicFunction · 0.92
TestOpen_TimeoutFunction · 0.92
testSQLDBFunction · 0.92
TestPGPubsub_MetricsFunction · 0.92
TestPGPubsubDriverFunction · 0.92
TestPubsubFunction · 0.92
TestPubsub_orderingFunction · 0.92
TestMeasureLatencyFunction · 0.92

Calls 3

DSNMethod · 0.80
HelperMethod · 0.65
CreateMethod · 0.65

Tested by 15

testSQLDBFunction · 0.74
TestOpenFunction · 0.74
TestOpen_InvalidDBFromFunction · 0.74
TestOpen_ValidDBFromFunction · 0.74
TestOpen_PanicFunction · 0.74
TestOpen_TimeoutFunction · 0.74
testSQLDBFunction · 0.74
TestPGPubsub_MetricsFunction · 0.74
TestPGPubsubDriverFunction · 0.74
TestPubsubFunction · 0.74
TestPubsub_orderingFunction · 0.74
TestMeasureLatencyFunction · 0.74