goeasy

command module
v0.0.0-...-123f038 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 5 Imported by: 0

README

goeasy

GoEasy 企业级 Go 微服务运行时框架。开发教程见 goeasy-cli/docs(GitBook 同步源)。

安装

# 1. 安装 goeasy-cli(代码生成工具)
go install github.com/txbao/goeasy-cli@latest
goeasy-cli new demo --module github.com/demo/demo --download=false
cd demo
go mod tidy
go run ./cmd/service

快速开始

cfg := config.MustLoad("configs/config.yaml")
application := app.New(cfg)
application.RegisterHTTP(bootstrap.RegisterRoutes)
application.Run()

能力分层

P0 核心 app, config, httpx, response, logger
P1 基础设施 database, cache, mq, grpcx, discovery, storage, scheduler
P2 治理 breaker, limiter, retry, loadbalance
P3 观测 trace, metrics, health, audit
P4 企业组件 errors, validator, pagination, idgen, contextx, jwt, casbin, crypto, apisign, eventbus
操作日志(audit)
  • 运维 JSONobservability.audit.enabledapp.Audit(stdout)
  • 业务持久化:实现 audit.Recorderapp.SetAuditRecorder(...) 注入
  • 上下文httpx.InjectOperatorContext + contextx.OperatorFrom
  • 详见 audit/README.md

配置示例

governance:
  limiter:
    enabled: true
    qps: 200
observability:
  metrics:
    enabled: true
    path: /metrics
  health:
    enabled: true
    path: /healthz
enterprise:
  jwt:
    enabled: true
    secret: change-me

开发指引

废弃

serverroutermiddleware 根包为早期占位,请使用 app + httpx

Documentation

Overview

示例入口:演示 goeasy/app 最小用法(非库导出)。

Jump to

Keyboard shortcuts

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