Skip to content

Instantly share code, notes, and snippets.

@ThakurPriyanka
Created May 1, 2019 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThakurPriyanka/97ab27cd07e37a95027f9ce584f60547 to your computer and use it in GitHub Desktop.
Save ThakurPriyanka/97ab27cd07e37a95027f9ce584f60547 to your computer and use it in GitHub Desktop.
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