I want to create an ACID transaction similar to the code above. Then I'm looking for a gist or Github repository or an example of how to use transactions (BeginTransaction, a few WriteTransaction's, commit or rollback statements depending on the case) so I can take a look at. The samples found in Neo4j documentation show only auto-commit transactions.
I'm really struggling with these statements:
//To attach a metadata to an explicit transaction:
session.BeginTransaction(WithTxMetadata(map[string)interface{}{"work-id": 1})) <====
// To attach a metadata to a write transaction function:
session.WriteTransaction(DoWork, WithTxMetadata(map[string)interface{}{"work-id": 1}))
session.WriteTransaction(DoWork2, WithTxMetadata(map[string)interface{}{"work-id": 104}))
I don't get why is necessary to set WithTxMetadata to begin a transaction.
I checked this code out. But it handles one transaction at time.
What I want to do is handle multiple Write transactions in a single ACID transaction - all successful or all fail. I guess I should use BeginTransaction to do this but not sure, it is not clear if this is the proper approach. Is this the approach of the Golang Neo4j community?
Florent, the example will do. Thank you very much.
Regarding the manual, I have downloaded Neo4j Go Driver Manual v4.2 (PDF) from Neo4j Documentation website. At page #25 there is that piece of code that doesn't work.