1
0
mirror of https://github.com/mrusme/neonmodem.git synced 2024-12-04 14:46:37 -05:00

Refactored adapter Capabilities

This commit is contained in:
マリウス 2023-01-05 00:23:25 -05:00
parent 3e32a7715a
commit 8e785c5ada
No known key found for this signature in database
GPG Key ID: 272ED814BF63261F
6 changed files with 20 additions and 5 deletions

View File

@ -1,6 +1,21 @@
package adapter
type Capabilities []Capability
type Capability struct {
ID string
Name string
}
func (caps *Capabilities) IsCapableOf(capability string) bool {
var can bool = false
for _, capb := range *caps {
if capb.ID == capability {
can = true
break
}
}
return can
}

View File

@ -35,7 +35,7 @@ func (sys *System) SetLogger(logger *zap.SugaredLogger) {
sys.logger = logger
}
func (sys *System) GetCapabilities() []adapter.Capability {
func (sys *System) GetCapabilities() adapter.Capabilities {
var caps []adapter.Capability
return caps

View File

@ -46,7 +46,7 @@ func (sys *System) SetLogger(logger *zap.SugaredLogger) {
sys.logger = logger
}
func (sys *System) GetCapabilities() []adapter.Capability {
func (sys *System) GetCapabilities() adapter.Capabilities {
var caps []adapter.Capability
caps = append(caps,

View File

@ -44,7 +44,7 @@ func (sys *System) SetLogger(logger *zap.SugaredLogger) {
sys.logger = logger
}
func (sys *System) GetCapabilities() []adapter.Capability {
func (sys *System) GetCapabilities() adapter.Capabilities {
var caps []adapter.Capability
caps = append(caps,

View File

@ -45,7 +45,7 @@ func (sys *System) SetLogger(logger *zap.SugaredLogger) {
sys.logger = logger
}
func (sys *System) GetCapabilities() []adapter.Capability {
func (sys *System) GetCapabilities() adapter.Capabilities {
var caps []adapter.Capability
caps = append(caps,

View File

@ -19,7 +19,7 @@ type System interface {
GetConfig() map[string]interface{}
SetConfig(cfg *map[string]interface{})
SetLogger(logger *zap.SugaredLogger)
GetCapabilities() []adapter.Capability
GetCapabilities() adapter.Capabilities
FilterValue() string
Title() string