Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public <T> boolean deleteNode(final T element) {
try (Transaction txn = dgraphClient.newTransaction()) {
try {
final DgraphProto.Mutation mutation = getDeleteMutation(element);
txn.mutate(mutation);
txn.commit();
return true;
} catch (StatusRuntimeException | TxnConflictException | JsonProcessingException dgraphException) {
txn.discard();
throw new RuntimeException("Unable to persist the transaction ", dgraphException);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment