Exemple #1
0
func (bag *embeddedRidBag) serializeDelegate(bw *rw.Writer) error {
	bw.WriteInt(int32(len(bag.links)))
	for _, l := range bag.links {
		if err := l.GetIdentity().ToStream(bw); err != nil {
			return err
		}
	}
	return bw.Err()
}
func (f binaryRecordFormatV0) writeDecimal(w *rw.Writer, o interface{}) {
	var d orient.Decimal
	switch v := o.(type) {
	case int64:
		d = orient.Decimal{Value: big.NewInt(v)}
	case *big.Int:
		d = orient.Decimal{Value: v}
	case orient.Decimal:
		d = v
	default:
		panic(orient.ErrTypeSerialization{Val: o, Serializer: f})
	}
	w.WriteInt(int32(d.Scale))    // scale value, 0 for ints
	w.WriteBytes(d.Value.Bytes()) // unscaled value
}
Exemple #3
0
func (bag *sbTreeRidBag) serializeDelegate(bw *rw.Writer) error {
	if bag.collectionPtr == nil {
		bw.WriteLong(-1)
		bw.WriteLong(-1)
		bw.WriteInt(-1)
	} else {
		bw.WriteLong(bag.collectionPtr.fileId)
		bw.WriteLong(bag.collectionPtr.pageIndex)
		bw.WriteInt(int32(bag.collectionPtr.pageOffset))
	}
	bw.WriteInt(-1) // TODO: cached size; need a real value for compatibility with <= 1.7.5
	bw.WriteInt(0)  // TODO: support changes in sbTreeRidBag
	return bw.Err()
}