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:
parent
e6be4a3fab
commit
6d89542403
|
@ -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))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue