mirror of
https://github.com/1f349/lavender.git
synced 2024-11-09 22:32:48 +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
|
|
}
|