fixed serialization and middleware compose

This commit is contained in:
yusing
2024-10-02 01:04:34 +08:00
parent 1bac96dc2a
commit ed887a5cfc
8 changed files with 74 additions and 48 deletions

View File

@@ -1,6 +1,7 @@
package docker
import (
"strconv"
"strings"
E "github.com/yusing/go-proxy/internal/error"
@@ -76,3 +77,11 @@ func BoolParser(value string) (any, E.NestedError) {
return nil, E.Invalid("boolean value", value)
}
}
func IntParser(value string) (any, E.NestedError) {
i, err := strconv.Atoi(value)
if err != nil {
return 0, E.Invalid("integer value", value)
}
return i, nil
}