MCPcopy Index your code
hub / github.com/rilldata/rill / Open

Function Open

admin/database/database.go:26–43  ·  view source on GitHub ↗

Open opens a new database connection. See ParseEncryptionKeyring for the expected format for encKeyringConfig.

(driver, dsn, encKeyringConfig string)

Source from the content-addressed store, hash-verified

24// Open opens a new database connection.
25// See ParseEncryptionKeyring for the expected format for encKeyringConfig.
26func Open(driver, dsn, encKeyringConfig string) (DB, error) {
27 d, ok := Drivers[driver]
28 if !ok {
29 return nil, fmt.Errorf("unknown database driver: %s", driver)
30 }
31
32 encKeyring, err := ParseEncryptionKeyring(encKeyringConfig)
33 if err != nil {
34 return nil, fmt.Errorf("error parsing encryption keyring: %w", err)
35 }
36
37 db, err := d.Open(dsn, encKeyring)
38 if err != nil {
39 return nil, err
40 }
41
42 return db, nil
43}
44
45// Driver is the interface for DB drivers.
46type Driver interface {

Callers 5

MigrateCmdFunction · 0.92
NewFunction · 0.92
TestPostgresFunction · 0.92
TestProvisionFunction · 0.92

Calls 3

ParseEncryptionKeyringFunction · 0.85
ErrorfMethod · 0.65
OpenMethod · 0.65

Tested by 2

TestPostgresFunction · 0.74
TestProvisionFunction · 0.74