Optimizer: make grid charging strategy configurable (#30782)
This commit is contained in:
parent
ebe4a3d6a3
commit
494f6cf9bb
14 changed files with 555 additions and 50 deletions
|
|
@ -143,6 +143,11 @@ func boolHandler(set func(bool) error, get func() bool) http.HandlerFunc {
|
|||
return handler(strconv.ParseBool, set, get)
|
||||
}
|
||||
|
||||
// stringHandler updates string-param api
|
||||
func stringHandler(set func(string) error, get func() string) http.HandlerFunc {
|
||||
return handler(func(s string) (string, error) { return s, nil }, set, get)
|
||||
}
|
||||
|
||||
// durationHandler updates duration-param api
|
||||
func durationHandler(set func(time.Duration) error, get func() time.Duration) http.HandlerFunc {
|
||||
return handler(util.ParseDuration, set, get)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue