File: encoding.go

package info (click to toggle)
golang-gopkg-dancannon-gorethink.v2 2.0.4-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 780 kB
  • sloc: makefile: 4
file content (32 lines) | stat: -rw-r--r-- 761 bytes parent folder | download | duplicates (6)
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)
}