1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2025-01-21 03:57:26 +00:00

utils: Remove unused json.AlwaysString

This commit is contained in:
diamondburned 2021-11-15 14:27:01 -08:00
parent e6be4a3fab
commit 6d89542403
No known key found for this signature in database
GPG key ID: D78C4471CE776659

View file

@ -1,10 +1,5 @@
package json
import (
"bytes"
"strconv"
)
type Marshaler interface {
MarshalJSON() ([]byte, error)
}
@ -42,17 +37,3 @@ func (m Raw) UnmarshalTo(v interface{}) error {
func (m Raw) String() string {
return string(m)
}
// AlwaysString would always unmarshal into a string, from any JSON type. Quotes
// will be stripped.
type AlwaysString string
func (m *AlwaysString) UnmarshalJSON(data []byte) error {
data = bytes.Trim(data, `"`)
*m = AlwaysString(data)
return nil
}
func (m AlwaysString) Int() (int, error) {
return strconv.Atoi(string(m))
}