Skip to content

Commit

Permalink
Add helper methods for sql plugin registeration (cadence-workflow#4024)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewjdawson2016 authored Mar 1, 2021
1 parent 6b048ce commit 4ed0171
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions common/persistence/sql/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@ func RegisterPlugin(pluginName string, plugin sqlplugin.Plugin) {
supportedPlugins[pluginName] = plugin
}

// RegisterPluginIfNotExists will register a SQL plugin only if a plugin with same name has not already been registered
func RegisterPluginIfNotExists(pluginName string, plugin sqlplugin.Plugin) {
if _, ok := supportedPlugins[pluginName]; !ok {
supportedPlugins[pluginName] = plugin
}
}

// PluginRegistered returns true if plugin with given name has been registered, false otherwise
func PluginRegistered(pluginName string) bool {
_, ok := supportedPlugins[pluginName]
return ok
}

// NewSQLDB creates a returns a reference to a logical connection to the
// underlying SQL database. The returned object is to tied to a single
// SQL database and the object can be used to perform CRUD operations on
Expand Down

0 comments on commit 4ed0171

Please sign in to comment.