From 76e35cf1bbf429dbc55ef759d800282f86426c7e Mon Sep 17 00:00:00 2001 From: tripathyr Date: Sun, 8 Oct 2023 15:37:36 +0530 Subject: [PATCH] Adding the documentation for functions --- docs/checksum-db.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 docs/checksum-db.md diff --git a/docs/checksum-db.md b/docs/checksum-db.md new file mode 100644 index 0000000..070e8c3 --- /dev/null +++ b/docs/checksum-db.md @@ -0,0 +1,28 @@ +### CheckDB Function Documentation + +#### Overview + +The `CheckDB` function is a JavaScript function that checks the integrity of a database by performing CRC32 checksum calculations on specified columns in specified tables. It returns a Promise that resolves to `true` if the operation is successful, and rejects with an error if there's any issue during the process. + +#### Description + +The function performs the following steps: + +1. Reads configuration from `../args/config.json`. +2. Initializes a database connection using the provided configuration. +3. Reads data structure from `../src/data_structure.json`. +4. Constructs a checksum query for specified columns. +5. Retrieves a list of tables from the database. +6. Performs checksum calculations on each table using the constructed query. +7. Logs the results in a tabular format. +8. Resolves the Promise with `true` if the operation is successful. + +#### Notes + +- Make sure the necessary configuration files (`config.json` and `data_structure.json`) are present in the specified paths. +- The function uses promises for asynchronous operations. Handle the resolved and rejected states accordingly in your code. +- Ensure proper error handling and logging for production use. + +Feel free to modify the function according to your specific requirements. + +**Note:** This documentation assumes that the necessary dependencies (`Database` and related functions) are properly imported and available in the codebase.