anchovy-gen-sv

command
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 Imports: 12 Imported by: 0

README

gensv

server路由代码生成

项目简介

自动生成server路由代码 支持以下功能:

  • 定义http方法(get/post/put...)
  • 定义请求路径
  • 定义请求绑定方式(uri/header/query/json/xml/yaml)
  • 记录日志trace id
  • 自定义swagger summary
  • 自定义接口版本号

使用方式:

  1. api.go文件中新增 以Server结束的interface
  2. 在api 文件夹中执行 go generate命令 将会生成相应的Server代码

注意:

swagger Param类型会根据bind进行猜测,若无bind将默认使用body,暂不支持定义form 定义了version的接口,将会根据version进行分组

注解参数:

名称 默认值 可用范围 说明 可选值 示例
summary 根据方法名称生成 全部 swagger接口名 demo
method get 全部 http method get/post/put... get
path 根据方法名称生成 全部 请求路径 - /sayHello
bind 全部 请求参数绑定类型 uri/query/header/json/xml/yaml json
version 全部 接口版本号 - v1

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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