Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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.