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