Should be called before database access is needed in any api call. Happens per default for each api call. It is important that you run runTaskInBackground to run a task which accquire database. Important do not forget to defer to releaseDatabaseConnection
()
| 139 | // runTaskInBackground to run a task which accquire database. |
| 140 | // Important do not forget to defer to releaseDatabaseConnection |
| 141 | func acquireDatabaseConnection() error { |
| 142 | if dbRequests == nil { |
| 143 | return nil |
| 144 | } |
| 145 | |
| 146 | errCh := make(chan error) |
| 147 | dbRequests <- dbRequest{acquiredb, errCh} |
| 148 | |
| 149 | return <-errCh |
| 150 | } |
| 151 | |
| 152 | // Release database connection when not needed anymore |
| 153 | func releaseDatabaseConnection() error { |
no outgoing calls
no test coverage detected