mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-29 13:21:55 +02:00
restructured the project to comply community guideline, for others check release note
This commit is contained in:
18
internal/proxy/fields/timeout.go
Normal file
18
internal/proxy/fields/timeout.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package fields
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
E "github.com/yusing/go-proxy/internal/error"
|
||||
)
|
||||
|
||||
func ValidateDurationPostitive(value string) (time.Duration, E.NestedError) {
|
||||
d, err := time.ParseDuration(value)
|
||||
if err != nil {
|
||||
return 0, E.Invalid("duration", value)
|
||||
}
|
||||
if d < 0 {
|
||||
return 0, E.Invalid("duration", "negative value")
|
||||
}
|
||||
return d, nil
|
||||
}
|
||||
Reference in New Issue
Block a user