MCPcopy Create free account
hub / github.com/kataras/iris / mustConnectDB

Function mustConnectDB

_examples/database/sqlx/main.go:54–68  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

52}
53
54func mustConnectDB() *sql.DB {
55 connString := fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s sslmode=disable",
56 host, port, user, password, dbname)
57 db, err := sql.Open("postgres", connString)
58 if err != nil {
59 panic(err)
60 }
61
62 err = db.Ping()
63 if err != nil {
64 panic(err)
65 }
66
67 return db
68}
69
70func mustCreateExtensions(ctx context.Context, db *sql.DB) {
71 query := `CREATE EXTENSION IF NOT EXISTS pgcrypto;`

Callers 1

mainFunction · 0.85

Calls 1

OpenMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…