From 8d6dfaf1abfa5ddf671148a51062daf8fbdcfd6a Mon Sep 17 00:00:00 2001 From: Sven Eigenbrodt Date: Mon, 3 Apr 2023 09:19:41 +0200 Subject: [PATCH] set deleted flag using literals --- internal/server/dataset.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/internal/server/dataset.go b/internal/server/dataset.go index 1292172..392af40 100644 --- a/internal/server/dataset.go +++ b/internal/server/dataset.go @@ -465,16 +465,16 @@ func (ds *Dataset) StoreEntitiesWithTransaction(entities []*Entity, txnTime int6 return newitems, err } - var deleted uint16 - if e.IsDeleted { - deleted = 1 - } binary.BigEndian.PutUint16(outgoingBuffer, OUTGOING_REF_INDEX) binary.BigEndian.PutUint64(outgoingBuffer[2:], rid) binary.BigEndian.PutUint64(outgoingBuffer[10:], uint64(txnTime)) binary.BigEndian.PutUint64(outgoingBuffer[18:], predid) binary.BigEndian.PutUint64(outgoingBuffer[26:], relatedid) - binary.BigEndian.PutUint16(outgoingBuffer[34:], deleted) // deleted. + if e.IsDeleted { + binary.BigEndian.PutUint16(outgoingBuffer[34:], 1) // deleted. + } else { + binary.BigEndian.PutUint16(outgoingBuffer[34:], 0) // deleted. + } binary.BigEndian.PutUint32(outgoingBuffer[36:], ds.InternalID) err = txn.Set(outgoingBuffer, []byte("")) if err != nil { @@ -486,7 +486,11 @@ func (ds *Dataset) StoreEntitiesWithTransaction(entities []*Entity, txnTime int6 binary.BigEndian.PutUint64(incomingBuffer[10:], rid) binary.BigEndian.PutUint64(incomingBuffer[18:], uint64(txnTime)) binary.BigEndian.PutUint64(incomingBuffer[26:], predid) - binary.BigEndian.PutUint16(incomingBuffer[34:], deleted) // deleted. + if e.IsDeleted { + binary.BigEndian.PutUint16(incomingBuffer[34:], 1) // deleted. + } else { + binary.BigEndian.PutUint16(incomingBuffer[34:], 0) // deleted. + } binary.BigEndian.PutUint32(incomingBuffer[36:], ds.InternalID) err = txn.Set(incomingBuffer, []byte("")) if err != nil {