Previously, we had three chained calls initializing a database: - InitWrappedDb calls NewDbMap - NewDbMap calls NewDbMapFromConfig Since all three are exporetd, this left me wondering when to call one vs the others. It turns out that NewDbMap is only called from tests, so I renamed it to DBMapForTest to make that clear. NewDbMapFromConfig is only called internally to the SA, so I made it unexported it as newDbMapFromMysqlConfig. Also, I copied the ParseDSN call into InitWrappedDb, so it doesn't need to call DBMapForTest. Now InitWrappedDb and DBMapForTest both independently call newDbMapFromMysqlConfig. I also noticed that InitDBMetrics was only called internally so I unexported it. |
||
|---|---|---|
| .. | ||
| testdata | ||
| main.go | ||
| main_test.go | ||