mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-21 08:59:47 +01:00
15 lines
264 B
Go
15 lines
264 B
Go
package fields
|
|
|
|
import (
|
|
E "github.com/yusing/go-proxy/error"
|
|
)
|
|
|
|
type Path string
|
|
|
|
func NewPath(s string) (Path, E.NestedError) {
|
|
if s == "" || s[0] == '/' {
|
|
return Path(s), E.Nil()
|
|
}
|
|
return "", E.Invalid("path", s).With("must be empty or start with '/'")
|
|
}
|