meta: wrap url type
This represents the URL cleanly during serialisation. Signed-off-by: Yonah <contrib@gensokyo.uk>
This commit is contained in:
20
meta/meta.go
Normal file
20
meta/meta.go
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
// Package meta defines system and member metadata types.
|
||||||
|
package meta
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding"
|
||||||
|
"net/url"
|
||||||
|
)
|
||||||
|
|
||||||
|
// URL implements [encoding] interfaces on top of [url.URL].
|
||||||
|
type URL struct{ url.URL }
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ encoding.TextAppender = new(URL)
|
||||||
|
_ encoding.TextMarshaler = new(URL)
|
||||||
|
_ encoding.TextUnmarshaler = new(URL)
|
||||||
|
)
|
||||||
|
|
||||||
|
func (u *URL) MarshalText() (data []byte, err error) { return u.MarshalBinary() }
|
||||||
|
func (u *URL) AppendText(data []byte) ([]byte, error) { return u.AppendBinary(data) }
|
||||||
|
func (u *URL) UnmarshalText(data []byte) error { return u.UnmarshalBinary(data) }
|
||||||
Reference in New Issue
Block a user