On Thu, Feb 8, 2018, at 07:28, Mandolyte wrote: > I'd like to use the same program against multiple databases and set the > driver by configuration. But since the driver is in the source code, I > don't see a way to do that. > > In other words, I don't want to include this in my code: > > > import ( > > _ "github.com/lib/pq" > > ) > > > I want to load it at run time. Is this possible?
If you are accessing your datastore through a common interface instead of making SQL queries directly, you could have each separate database you want to support be a different plugin (https://godoc.org/plugin) that implements your datastore abstraction and load the correct plugin at runtime. It hardly seems worth the complexity or maintainability cost though. —Sam -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.