When I use the Badger database and make a query, I close the database at the end of all the code.
defer db.Close() //golang code
If the program fails before the end, the database loses all records. How can this be avoided if I need to make requests several times, and in the end write the result to the database?
The Dgraph has a LOCK file for this situation.