Kepler core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

35 lines
789 B

package configs
import (
"strconv"
"time"
)
type Duration time.Duration
type HexUint32 uint32
type HexUint16 uint16
type HexUint8 uint8
func (self *Duration) UnmarshalText(text []byte) error {
t, err := time.ParseDuration(string(text))
*self = Duration(t)
return err
}
func (self *HexUint32) UnmarshalText(text []byte) error {
t, err := strconv.ParseUint(string(text), 16, 32)
*self = HexUint32(t)
return err
}
func (self *HexUint16) UnmarshalText(text []byte) error {
t, err := strconv.ParseUint(string(text), 16, 16)
*self = HexUint16(t)
return err
}
func (self *HexUint8) UnmarshalText(text []byte) error {
t, err := strconv.ParseUint(string(text), 16, 8)
*self = HexUint8(t)
return err
}