Skip to content

Commit

Permalink
Merge pull request #220 from mimiro-io/fix/workaround_go_issue_59367
Browse files Browse the repository at this point in the history
set deleted flag using literals
  • Loading branch information
rompetroll authored Apr 3, 2023
2 parents a4bf0e1 + 8d6dfaf commit 7871ba4
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions internal/server/dataset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit 7871ba4

Please sign in to comment.