跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[Go 编程语言] Vgo(基于 Gin 开发的开源服务端框架)[20240907 更新]增加代码生成工具、增加雪花 ID 算法(扩展)、集成 ws

发表于

Vgo

介绍 📖

Vgo 是一款基于 Gin 开发的开源服务端框架。

  • 使用了 Redis 、Mysql 、JWT 、队列、等技术栈。
  • 比较适合 Golang 初学者作为学习项目学习。
  • 当前框架内实现了基本的 Rbac 权限管理(使用 casbin )、队列、websocket 、文件日志等功能。
  • 后续将陆续增加更多功能,欢迎大家共同参与进来。
  • 本项目主要是为了学习 Golang 而开发的,所以代码中难免有不足之处,还请大家多多包涵。

代码仓库 (记得 Star)

安装使用步骤 📔

  • 下载:
git clone -b https://github.com/xuewuzhiijngych/vgo.git
  • 安装:

  • 使用 Mysql8 ,导入根目录的 go_study.sql 文件。

  • 准备 redis

  • 修改根目录下的 config.yaml 文件,配置 Mysql 、Redis 、JWT 等信息。

  • 根目录的 asynq.yml 文件是配置 asynq 命令工具的,不使用,忽略即可。

  • 执行以下命令安装依赖包:

go mod tidy
  • 运行:
go run main.go

项目目录 📚

Vgo
├─ app                        # Vite 配置项
├─ AdminUser                  # 模块
│  ├─ Bapi                    # Bapi 后台接口
│  ├─ Api                     # Api 前台接口
│  ├─ Model                   # Model 模型
│  ├─ Router                  # Router 路由
├─ bootstrap                  # 框架启动文件
├─ core                       # 框架核心文件
│  ├─ ...                     # 后续出详细介绍(亦可以自己通过源码了解)
├─ job                        # 队列
├─ route                      # 路由
├─ storage                    # 日志或静态资源
│  ├─ logs                    # 日志
├─ asynq.yml                  # asynq 配置文件
├─ config.yaml                # 框架配置文件

前台使用 🌎

代码生成 🏢

  • 生成基本增删改查的 golang 代码,可使用命令:
go run vTools.go --module=Product --note=产品
  • 执行代码后,会在 app 目录下生成一个 Product 模块,里面包含了增删改查的相关代码。
  • 随后需要自己在根目录 route/router.go 文件中注册路由。 [后期实现自动注册]

后续计划 🔮

  • 后续将陆续增加更多功能,欢迎大家共同参与进来。
  • 如有任何问题,请联系作者:601266867@qq.com

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.