()
| 52 | } |
| 53 | |
| 54 | func 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 | |
| 70 | func mustCreateExtensions(ctx context.Context, db *sql.DB) { |
| 71 | query := `CREATE EXTENSION IF NOT EXISTS pgcrypto;` |