1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
package encoding
import (
"reflect"
"time"
)
var (
// type constants
stringType = reflect.TypeOf("")
timeType = reflect.TypeOf(new(time.Time)).Elem()
marshalerType = reflect.TypeOf(new(Marshaler)).Elem()
unmarshalerType = reflect.TypeOf(new(Unmarshaler)).Elem()
)
// Marshaler is the interface implemented by objects that
// can marshal themselves into a valid RQL psuedo-type.
type Marshaler interface {
MarshalRQL() (interface{}, error)
}
// Unmarshaler is the interface implemented by objects
// that can unmarshal a psuedo-type object of themselves.
type Unmarshaler interface {
UnmarshalRQL(interface{}) error
}
func init() {
encoderCache.m = make(map[reflect.Type]encoderFunc)
decoderCache.m = make(map[decoderCacheKey]decoderFunc)
}
|