I want to get the path or even the connection string of a sql.DB instance. The package I'm writing doesn't know what the database path is and the application may have multiple database files. However I need to be able to map a specific database to a specific buffered channel, and ignore any additional calls for a database the package has already seen.
The application uses the github.com/mutecomm/go-sqlcipher driver to instantiate the database, if that makes any difference.
Is it possible to discriminate between instances of sql.DB based on the file path of the source database? If so, how do I do it?
New(db *sql.DB) (Settings, error). The package will take any db and return a Settings struct that has settings table related funcs. But the application can have multiple databases each with its own settings table. The application frustratingly instantiates the Settings struct in multiple places by different services that want to access the settings, and I need to trigger events when certain settings are changed. The channel is the event stackPRAGMA database_listis probably the best answer.