mirror of
https://github.com/1f349/tulip.git
synced 2024-12-23 00:34:07 +00:00
22 lines
284 B
Go
22 lines
284 B
Go
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
|
|
}
|