Adding a way to decode to a specified version.

This is largely needed as a way to get a versioned client without
requiring everyone to switch to versioned types at once.
This commit is contained in:
Kris Rousey
2015-08-07 12:45:20 -07:00
parent 213e7a8ab6
commit 6e64a63a84
7 changed files with 49 additions and 7 deletions

View File

@@ -77,3 +77,10 @@ type codecWrapper struct {
func (c *codecWrapper) Encode(obj Object) ([]byte, error) {
return c.EncodeToVersion(obj, c.version)
}
// TODO: Make this behaviour default when we move everyone away from
// the unversioned types.
//
// func (c *codecWrapper) Decode(data []byte) (Object, error) {
// return c.DecodeToVersion(data, c.version)
// }