Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • B boilerplate
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 7
    • Merge requests 7
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Terraform modules
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Pavel Shustrov
  • boilerplate
  • Merge requests
  • !5

Updated code structure

  • Review changes

  • Download
  • Patches
  • Plain diff
Open Ghost User requested to merge arpan/code-structure into master Apr 13, 2022
  • Overview 0
  • Commits 1
  • Pipelines 0
  • Changes 18

Folder structure updates:

  1. Introduced api folder at the root of project that handles various functions in the network layer like:
    1. Parsing requests
    2. Authorization
    3. Rendering responses etc..
  2. Since we are moving ahead with gin all the APIs defined in the service interface will have the structure:
    FunctionName(ctx *gin.Context)
  3. Added usecase folder inside internal that houses all the functionalities defined as per business requirements. Our APIs depends on these functionalities directly.
  4. Added deps folder that contains all the dependencies of our usecase as different interfaces. These interfaces are implemented by their corresponding components.

As an example, a vehicle service is created that exposes 3 APIs:

  1. Create Vehicle
  2. Get Vehicle
  3. List Vehicles

The above 3 APIs are 3 different business requirements and needs to be defined in the usecase interface. To implement this, the usecase depends on vehicles component. This component implements the VehicleRepo dependency inside it's internal package and exposes the functions through vehicle.MakeRepo().

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: arpan/code-structure

For any queries, kindly contact us on Slack channel https://cafuglobal.slack.com/archives/C056RSXMPB7