feat: 为StrToBool添加"t"和"f"的处理

main
NoahLan 1 year ago
parent 0d0b909ac2
commit d4a936cb17

@ -28,9 +28,9 @@ func ToBool(v any) (bool, error) {
func StrToBool(s string) (bool, error) { func StrToBool(s string) (bool, error) {
lower := strings.ToLower(s) lower := strings.ToLower(s)
switch lower { switch lower {
case "1", "on", "yes", "true": case "1", "on", "yes", "true", "t":
return true, nil return true, nil
case "0", "off", "no", "false": case "0", "off", "no", "false", "f":
return false, nil return false, nil
} }

Loading…
Cancel
Save