Generate code from API files

Time:2022-1-6

command

goctl api go -api shorturl.api -dir .

Generate directory structure


[email protected] api % goctl api go -api shorturl.api -dir .
Done.
[email protected] api % tree
.
├── etc
│   └── shorturl-api.yaml
├── internal
│   ├── config
│   │   └── config.go
│   ├── handler
│   │   ├── expandhandler.go
│   │   ├── routes.go
│   │   └── shortenhandler.go
│   ├── logic
│   │   ├── expandlogic.go
│   │   └── shortenlogic.go
│   ├── svc
│   │   └── servicecontext.go
│   └── types
│       └── types.go
├── shorturl.api
└── shorturl.go

7 directories, 11 files
[email protected] api % 

Official introduction

.
├── api
│   ├── etc
│   │   └── shorturl-api. Yaml // configuration file
│   ├── internal
│   │   ├── config
│   │   │   └── config. Go // define configuration
│   │   ├── handler
│   │   │   ├── expandhandler. Go // implement expandhandler
│   │   │   ├── routes. Go // define routing processing
│   │   │   └── shortenhandler. Go // implement shortenhandler
│   │   ├── logic
│   │   │   ├── expandlogic. Go // implement expandlogic
│   │   │   └── shortenlogic. Go // implement shortenlogic
│   │   ├── svc
│   │   │   └── servicecontext. Go // define servicecontext
│   │   └── types
│   │       └── types. Go // define the request and return the structure
│   ├── shorturl.api
│   └── shorturl. Go // mainentry definition
├── go.mod
└── go.sum

This work adoptsCC agreement, reprint must indicate the author and the link to this article

Recommended Today

19 free resource websites

Find some treasure resources and share them with you. 1、 Invincible omnipotent integrated navigation station 1. Insect tribe (aggregate search platform) https://search.chongbuluo.com 2.科塔学术(专业学术导航) https://site.sciping.com 3.码力全开(设计资源导航) https://design.maliquankai.com 4.SeeSeed(设计资源导航2) https://www.seeseed.com 5.书享家(电子书资源导航) http://shuxiangjia.cn 6.HiPPTer(PPT资源导航) https://www.hippter.com 二、学习资源 7.哔哩哔哩(直接吹爆) https://www.bilibili.com 8.第一教程网(课程学习资源) https://www.diyijc.com 9.北大教材(精品学习教材) https://pup6.yunzhan365.com/bookcase/jmyr/index.html 10.考试酷(百万题库网站) https://www.examcoo.com/index/ku 11.外语慕课平台(外语学习好渠道) https://moocs.unipus.cn 三、图片视频资源 12.Wallhaven(宝藏壁纸网站) https://wallhaven.cc 13.Unsplash(优质图片资源) https://unsplash.com 14.Videvo(精品视频图片资源) https://www.videvo.net 15.Pixabay(图片视频音频图形插画) https://pixabay.com 16.Pexels(老牌图库网站) https://www.pexels.com/zh-cn 四、稀缺宝藏资源 […]