Categorygithub.com/saurabh-sde/employee-go
modulepackage
0.0.0-20240526224343-248c1f2b69d3
Repository: https://github.com/saurabh-sde/employee-go.git
Documentation: pkg.go.dev

# README

Problem Description:

You are tasked with creating a Go application that manages a simple employee database or in-memory store. Additionally, you need to implement a RESTful API with pagination for listing employee records.

Requirements:

  1. Employee Struct:
  • Define a struct named Employee with the following fields:

  • ID (int): Unique identifier for the employee.

  • Name (string): Name of the employee.

  • Position (string): Position/title of the employee.

  • Salary (float64): Salary of the employee.

  1. CRUD Operations:
  • Implement functions/methods to perform CRUD operations on the employee database or in-memory store:

  • CreateEmployee: Adds a new employee to the database or store.

  • GetEmployeeByID: Retrieves an employee from the database or store by ID.

  • UpdateEmployee: Updates the details of an existing employee.

  • DeleteEmployee: Deletes an employee from the database or store by ID.

  1. Concurrency:
  • Ensure that the application is safe for concurrent use by using appropriate synchronization mechanisms.
  1. Testing:
  • Write unit tests to cover the CRUD operations and ensure the correctness of the implementation.
  1. RESTful API with Pagination:
  • Implement a RESTful API for listing employee records with pagination.

  • The API should provide endpoints for listing employees with support for pagination.

  • Each page should contain a configurable number of records.

  • Implement proper error handling and response formatting for the API endpoints

Updated

1. Added Mux and Gin

2. Added Air for auto live reload on save

Updated 2

1. Used Mongo DB for Gin apis

2. Create Docker setup

Setup - Auto Reloading Server

  1. Clone repo and run go mod tidy
  2. complete air setup by following this - https://github.com/cosmtrek/air
  3. run air in project root directory

Setup - Manaul Server Update

  1. Clone repo and run go mod tidy
  2. run go run main.go in project root directory

Setup - using Docker local build

  1. Clone repo and install docker
  2. Run docker-compose up --build

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author