Plugins: Standardize Golang enum naming convention (#69449)

* standardize enum pattern

* fix up
This commit is contained in:
Will Browne
2023-06-08 12:21:19 +02:00
committed by GitHub
parent 4db6679460
commit a221e1d226
31 changed files with 308 additions and 306 deletions

View File

@ -101,11 +101,11 @@ func (p PluginDTO) Base() string {
}
func (p PluginDTO) IsApp() bool {
return p.Type == App
return p.Type == TypeApp
}
func (p PluginDTO) IsCorePlugin() bool {
return p.Class == Core
return p.Class == ClassCore
}
// JSONData represents the plugin's plugin.json
@ -459,35 +459,35 @@ func (p *Plugin) StaticRoute() *StaticRoute {
}
func (p *Plugin) IsRenderer() bool {
return p.Type == Renderer
return p.Type == TypeRenderer
}
func (p *Plugin) IsSecretsManager() bool {
return p.Type == SecretsManager
return p.Type == TypeSecretsManager
}
func (p *Plugin) IsApp() bool {
return p.Type == App
return p.Type == TypeApp
}
func (p *Plugin) IsCorePlugin() bool {
return p.Class == Core
return p.Class == ClassCore
}
func (p *Plugin) IsBundledPlugin() bool {
return p.Class == Bundled
return p.Class == ClassBundled
}
func (p *Plugin) IsExternalPlugin() bool {
return p.Class == External
return p.Class == ClassExternal
}
type Class string
const (
Core Class = "core"
Bundled Class = "bundled"
External Class = "external"
ClassCore Class = "core"
ClassBundled Class = "bundled"
ClassExternal Class = "external"
)
func (c Class) String() string {
@ -495,26 +495,26 @@ func (c Class) String() string {
}
var PluginTypes = []Type{
DataSource,
Panel,
App,
Renderer,
SecretsManager,
TypeDataSource,
TypePanel,
TypeApp,
TypeRenderer,
TypeSecretsManager,
}
type Type string
const (
DataSource Type = "datasource"
Panel Type = "panel"
App Type = "app"
Renderer Type = "renderer"
SecretsManager Type = "secretsmanager"
TypeDataSource Type = "datasource"
TypePanel Type = "panel"
TypeApp Type = "app"
TypeRenderer Type = "renderer"
TypeSecretsManager Type = "secretsmanager"
)
func (pt Type) IsValid() bool {
switch pt {
case DataSource, Panel, App, Renderer, SecretsManager:
case TypeDataSource, TypePanel, TypeApp, TypeRenderer, TypeSecretsManager:
return true
}
return false