Skip to content

Build base scr golang with gin, gorm, redis, viper and more to custom func

Notifications You must be signed in to change notification settings

phankieuphu/go-lang-base

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

system/
  cmd/
    server/
      main.go
  internal/
    app/
      app.go
    handler/
      voucher.go
    model/
      voucher.go
    repository/

  util/
    database.go
  vendor/
  .env
  .env.example
  .gitignore
  go.mod
  go.sum
  README.md

Here's what each component of the project structure does:

  1. cmd
  • cmd/server/main.go: This is the main entry point for the application, and is responsible for starting the Gin web server and handling HTTP requests.
  1. Internal
  • internal/app/app.go: This file contains the code for initializing the Gin web framework and setting up middleware, such as logging or authentication.

  • internal/handler/voucher.go: This file contains the code for handling HTTP requests related to vouchers, such as redeeming a voucher or retrieving information about a voucher.

  • internal/model/voucher.go: This file contains the Go struct for representing a voucher, with fields for the voucher code, expiration date, and redemption status.

  • internal/repository/voucher.go: This file contains the code for interacting with the PostgreSQL database to retrieve, create, and update vouchers.

  • internal/util/database.go: This file contains the code for connecting to the PostgreSQL database and executing SQL queries.

  1. Vendor
  • vendor/: This directory contains the dependencies for the project, managed using Go's built-in go mod tool.
  1. .env: This file contains environment variables for the application, such as the database connection details.

  2. .env.example: This file provides an example of the environment variables that should be defined in the .env file.

  3. .gitignore: This file specifies files and directories that should be ignored by Git.

  4. go.mod and go.sum: These files are generated by Go's go mod tool and manage the dependencies for the project.

  5. README.md: This file provides a high-level overview of the project, including instructions for building and running the application.

About

Build base scr golang with gin, gorm, redis, viper and more to custom func

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published