getDB lazily instantiates a database connection pool. Users of Cloud Run or Cloud Functions may wish to skip this lazy instantiation and connect as soon as the function is loaded. This is primarily to help testing.
()
| 40 | // Cloud Functions may wish to skip this lazy instantiation and connect as soon |
| 41 | // as the function is loaded. This is primarily to help testing. |
| 42 | func getDB() *sql.DB { |
| 43 | once.Do(func() { |
| 44 | db = mustConnect() |
| 45 | }) |
| 46 | return db |
| 47 | } |
| 48 | |
| 49 | // migrateDB creates the votes table if it does not already exist. |
| 50 | func migrateDB(db *sql.DB) error { |
no test coverage detected