tulip/utils/json-url.go

22 lines
284 B
Go
Raw Permalink Normal View History

2024-01-29 10:44:45 +00:00
package utils
import (
"encoding"
"net/url"
)
type JsonUrl struct {
*url.URL
}
var _ encoding.TextUnmarshaler = &JsonUrl{}
func (s *JsonUrl) UnmarshalText(text []byte) error {
parse, err := url.Parse(string(text))
if err != nil {
return err
}
s.URL = parse
return nil
}