anchovy

module
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2020 License: MIT

README

anchovy

基于gin和gqlgen的自动生成代码的脚手架

介绍

anchovy的灵感来源于bilibili的微服务框架kratos. 代码的很多模块都借鉴了kratos的实现,以及从kratos搬运了相当一部分源代码。

anchovy旨在能够通过工具生成一些重复的代码,以让开发专注于业务。

功能

  • server: 集成了gin框架,使用gin作为路由和路由中间件
  • app、ecode: 自定义了一套错误码机制和返回体
  • cache: 集成redigo框架,并从kratos处借鉴了对pipline操作的优化
  • database: 采用kratos关于mysql的模块,去除了监控部分
  • conf: 集成viper,使用viper作为配置文件的管理
  • log: 集成zap,使用zap作为日志记录,但只开放了info,warn和error三种日志级别
  • trace: 基于opentracing,集成了全链路trace支持,使用者只需要向opentracing注册globalTracer即可
  • tool: 工具链,可快速生成模板项目,也可以通过示例中的接口定义,使用各自子工具生成各自模块的代码

快速开始

要求

Go version>=1.13

安装

GO111MODULE=on && go get -u github.com/shy-anchovy/anchovy/tool/anchovy anchovy new anchovy-demo -d ./

通过anchovy new 会快速生成基于kratos库的脚手架代码,如生成 anchovy-demo

Directories

Path Synopsis
api
定义项目 API 的文件 用于描述 HTTP API
定义项目 API 的文件 用于描述 HTTP API
pkg
app
log
sync/errgroup
Package errgroup provides synchronization, error propagation, and Context errgroup 包为一组子任务的 goroutine 提供了 goroutine 同步,错误取消功能.
Package errgroup provides synchronization, error propagation, and Context errgroup 包为一组子任务的 goroutine 提供了 goroutine 同步,错误取消功能.
tool
anchovy-gen-project
You can use the "packr clean" command to clean up this, and any other packr generated files.
You can use the "packr clean" command to clean up this, and any other packr generated files.
anchovy-gen-project/packrd
You can use the "packr2 clean" command to clean up this, and any other packr generated files.
You can use the "packr2 clean" command to clean up this, and any other packr generated files.
pkg

Jump to

Keyboard shortcuts

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