WithDrivers instructs the Providers to add new drivers or replace existing drivers. (By default, only "mysql", "sqlite", and "clickhouse" drivers are registered out of box.) For example, if SqlServer driver and mysql driver are need, we can pass in the following option WithDriver(map[string]func(ds
(drivers Drivers)
| 30 | // need, we can pass in the following option |
| 31 | // WithDriver(map[string]func(dsn string){"sqlserver": sqlServer.Open, "mysql": mysql.Open}) |
| 32 | func WithDrivers(drivers Drivers) ProvidersOptionFunc { |
| 33 | return func(options *providersOption) { |
| 34 | options.drivers = drivers |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | // WithReload toggles whether the factory should reload cached instances upon |
| 39 | // OnReload event. |
no outgoing calls