-
Notifications
You must be signed in to change notification settings - Fork 386
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #775 from lbbniu/feat/lbbniu/idlenode
feat(idlenode): Idle Node Plugin Enhancement
- Loading branch information
Showing
15 changed files
with
301 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package apis | ||
|
||
import ( | ||
"strconv" | ||
"time" | ||
) | ||
|
||
func (r Recommender) GetConfigFloat(key string, def float64) (float64, error) { | ||
if value, exists := r.Config[key]; exists { | ||
return strconv.ParseFloat(value, 64) | ||
} | ||
return def, nil | ||
} | ||
|
||
func (r Recommender) GetConfigInt(key string, def int64) (int64, error) { | ||
if value, exists := r.Config[key]; exists { | ||
return strconv.ParseInt(value, 10, 64) | ||
} | ||
return def, nil | ||
} | ||
|
||
func (r Recommender) GetConfigBool(key string, def bool) (bool, error) { | ||
if value, exists := r.Config[key]; exists { | ||
return strconv.ParseBool(value) | ||
} | ||
return def, nil | ||
} | ||
|
||
func (r Recommender) GetConfigString(key string, def string) string { | ||
if value, exists := r.Config[key]; exists { | ||
return value | ||
} | ||
return def | ||
} | ||
|
||
func (r Recommender) GetConfigDuration(key string, def time.Duration) (time.Duration, error) { | ||
if value, exists := r.Config[key]; exists { | ||
return time.ParseDuration(value) | ||
} | ||
return def, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.