This project provides a backend service for managing Excel data through three main functionalities: uploading, viewing, and editing records. It processes Excel files, stores the data in a MySQL database, and uses Redis for caching.
- Upload: Upload an Excel file, which is processed to save data in a MySQL table and cached in Redis for 5 minutes.
- View: Retrieve records from the Redis cache first; if not available, fallback to the MySQL database.
- Edit: Update specific records in both the MySQL database and Redis cache.
- Go: The programming language used for backend development.
- MySQL: For persistent data storage.
- Redis: For caching data temporarily.
- Gin: A web framework for Go used to handle HTTP requests.
- Method:
POST - Endpoint:
/upload - Description: Uploads an Excel file, processes it, and saves its contents to the MySQL database and Redis cache.
- Request: An Excel file in the form-data.
- Method:
GET - Endpoint:
/view - Description: Retrieves records, checking the Redis cache first; if the data is not in the cache, it retrieves from the MySQL database.
- Method:
PUT - Endpoint:
/edit - Description: Updates a specific record in the database and Redis.
- Request Body: JSON object with the record details, including the ID and fields to be updated.
-
Clone the repository: git clone https://github.com/tnlmao/Excel_File_Processor.git cd Go_Assignment/
-
Install Dependencies: go mod tidy
-
Setup Database: Create a MySQL database and configure the connection in your code.
-
Start the server go run main.go
-
Upload an Excel file: Use Postman or a similar tool to send a POST request to /upload with the Excel file.
-
View data: Send a GET request to /view to see the data
-
Edit a record: Send a PUT request to /edit with the JSON payload containing the updated record.
- Gave alternate implementation for inserting data in database using a csv files.