Skip to content

This is a demo Go project demonstrating GIN, Logging, Refresh cron job and Loading data from CSV to db

Notifications You must be signed in to change notification settings

itscodemen/sales_analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sales Analysis API

A RESTful API for analyzing historical sales data using Go, Gin framework, and MySQL.

Prerequisites

  • Go 1.16+
  • MySQL

Setup

  1. Clone the Repository:

    git clone <repository-url>
    cd sales-analysis
  2. Set Up Environment Variables:

    Create a .env file with:

    DB_USER=<your_db_user>
    DB_PASSWORD=<your_db_password>
    DB_NAME=<your_db_name>
    DB_HOST=<your_db_host>
    DB_PORT=<your_db_port>
  3. Install Dependencies:

    go mod tidy
  4. Run the Application:

    go run main.go

    The server will start on port 8080.

API Endpoints

Get Total Revenue

  • URL: /revenue
  • Method: GET
  • Query Parameters:
    • start_date: YYYY-MM-DD
    • end_date: YYYY-MM-DD

Sample Request

GET /revenue?start_date=2023-01-01&end_date=2023-12-31

About

This is a demo Go project demonstrating GIN, Logging, Refresh cron job and Loading data from CSV to db

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages