mirror of
https://github.com/1f349/lavender.git
synced 2024-11-13 23:21:38 +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
|
|
}
|