gbx

command
v1.37.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Command gbx 是 go-blackbox 脚手架的代码生成 CLI: 一键生成符合泰山版规范 + 安全基线的完整业务项目骨架。

用法(两种形式等价):

gbx new -name demo                    // 在当前目录生成 ./demo(默认 code 风格)
gbx -name demo
gbx new -name demo -style config      // 配置驱动风格(AutoConfigure + config.toml 模块开关)
gbx new -name demo -module github.com/connor/demo
gbx new -name demo -dir D:\projects

风格:

  • code(默认):代码式显式装配(builder.Enable* 链,对标 Spring Boot 3 @Configuration + @EnableXxx)
  • config:配置驱动装配(builder.AutoConfigure + config.toml [modules] 开关,对标自动配置 + yml)

生成内容:

  • main.go:应用骨架(日志/Web/中间件安全基线/JWT 认证/健康检查/监控/Admin/迁移/数据权限)
  • internal/model:StandardModel 业务模型示例
  • internal/handler:业务 handler 示例(统一响应 + 错误码 + 数据权限)
  • config.toml / go.mod / README.md / .gitignore

安装:go install github.com/Connorig/go-blackbox/tool/gbx 或直接:go run github.com/Connorig/go-blackbox/tool/gbx new -name demo

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL