Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/phankieuphu/go-lang-base
Build base scr golang with gin, gorm, redis, viper and more to custom func
https://github.com/phankieuphu/go-lang-base
gin go golang gorm postgresql redis viper
Last synced: about 3 hours ago
JSON representation
Build base scr golang with gin, gorm, redis, viper and more to custom func
- Host: GitHub
- URL: https://github.com/phankieuphu/go-lang-base
- Owner: phankieuphu
- Created: 2023-02-22T19:48:49.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-26T15:10:08.000Z (4 months ago)
- Last Synced: 2024-11-15T22:25:58.342Z (about 7 hours ago)
- Topics: gin, go, golang, gorm, postgresql, redis, viper
- Language: Go
- Homepage:
- Size: 31.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
- ORM --> gorm https://github.com/go-gorm/gorm
- Database --> postgresql https://www.postgresql.org/
- Framework --> gin https://github.com/gin-gonic/gin
- Cache --> redis https://redis.io
- Stucture --> kafka
- Type_api --> resful
- Devops --> dev ( heroku ) --> prod ( aws google-cloud)
- Target --> voucher
- Env manager --> Viper```
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.
2. 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.
2. Vendor
- vendor/: This directory contains the dependencies for the project, managed using Go's built-in go mod tool.
3. .env: This file contains environment variables for the application, such as the database connection details.
4. .env.example: This file provides an example of the environment variables that should be defined in the .env file.
5. .gitignore: This file specifies files and directories that should be ignored by Git.
6. go.mod and go.sum: These files are generated by Go's go mod tool and manage the dependencies for the project.
7. README.md: This file provides a high-level overview of the project, including instructions for building and running the application.