func (dec *Decoder) decodeBinaryUnmarshaler(v encoding.BinaryUnmarshaler) error { data, err := ioutil.ReadAll(dec.r) if err != nil { return err } return v.UnmarshalBinary(data) }
func RedisParseBinary(res string, obj encoding.BinaryUnmarshaler, err error) error { if err != nil { return err } err = obj.UnmarshalBinary([]byte(res)) return err }
// DecodeLV reads the length-value record from r and unmarshals it into v. func DecodeLV(r io.Reader, v encoding.BinaryUnmarshaler) error { buf, err := ReadLV(r) if err != nil { return err } if err := v.UnmarshalBinary(buf); err != nil { return err } return nil }
func copyBinary(t *testing.T, from encoding.BinaryMarshaler, to encoding.BinaryUnmarshaler) { data, err := from.MarshalBinary() if err != nil { t.Errorf(err.Error()) return } err = to.UnmarshalBinary(data) if err != nil { t.Errorf(err.Error()) return } }
// Unmarshaler decodes a encoding.BinaryUnmarshaler from buffer func (d *Dec) Unmarshaler(x encoding.BinaryUnmarshaler) { if d.err != nil { return } if d.i >= len(d.decbuf) || d.i < 0 /*overflow*/ { d.err = errNoDecData return } if x == nil { d.err = errDecode return } d.err = x.UnmarshalBinary(d.ByteSlice()) }
// Get implements KeyValueStore. func (l *LevelDB) Get(key encoding.BinaryMarshaler, value encoding.BinaryUnmarshaler) (bool, error) { k, err := key.MarshalBinary() if err != nil { return false, err } raw, err := l.storage.Get(k, l.readOpts) if err == leveldb.ErrNotFound { return false, nil } if err != nil { return false, err } if value == nil { return true, nil } return true, value.UnmarshalBinary(raw) }
func (i *levelDBKeyValueAccessor) Value(value encoding.BinaryUnmarshaler) error { return value.UnmarshalBinary(i.it.Value()) }
func (i *levelDBKeyValueAccessor) Key(key encoding.BinaryUnmarshaler) error { return key.UnmarshalBinary(i.it.Key()) }
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecBinaryUnmarshal(bm encoding.BinaryUnmarshaler) { fnerr := bm.UnmarshalBinary(f.d.d.DecodeBytes(nil, false, true)) if fnerr != nil { panic(fnerr) } }