Introduction
goctl is pronounced as go control, not as go C-T-L. goctl means not to be controlled by the code, but to control it. Where go does not mean golang. When I designed goctl, I wanted to use her to free our hands π
api generationβ
| Name | Function | Example | 
|---|---|---|
-o | generate api file | goctl api -o user.api | 
new | Quickly create an api service | goctl api new user | 
format | api formattingοΌvscodeUsing -dirTarget Catalog -iuWhether to automatically update goctl -stdinWhether to read data from standard input | |
validate | Verify that the api file is valid -api Specify api file source | goctl api validate -api user.api | 
doc | generate doc markdown -dir specify directory | goctl api doc -dir user | 
go | Generate golang api service-dirSpecify the generated code directory-apiSpecify api file source-forceWhether to force an overwrite of an existing filestyleSpecify filename naming styleοΌgozero: LowercaseοΌgo_zero: Underline,GoZero: humps | |
java | Generate code to access api service - java language-dir specify code storage directory-api specify api file source | |
ts | Generate code to access api service - ts language-dirSpecify the code storage directory-apiSpecify api file sourcewebapicallerunwrap | |
dart | generate access to api service code-dart language-dir specify code storage directory-api specify api file source | |
kt | Generate code to access api services - kotlin language-dirSpecify the code storage directory-apiSpecify api file sourcepkgSpecify package name | |
plugin | -pluginExecutable files-dirCode storage target folder-apiapi source code file-styleFile name naming formatting | 
rpc generationβ
| Name | Function | Example | 
|---|---|---|
new | Quickly generate an rpc service-idea identifies whether the command comes from the idea plugin, for idea plugin development use, terminal execution please ignore [optional parameter]-style specifies the filename naming style, gozero:lowercase,go_zero:underscore,GoZero:hump | |
template | create a proto template file-idea identifies whether the command comes from the idea plugin, for use in idea plugin development, ignore [optional parameter]-out,o specifies the code storage directory | |
proto | Generate rpc services based on proto-src,sSpecify the proto file source-proto_path,ISpecify the proto import lookup directory, protoc native command, please refer to protoc -h to see the specific usage-dir,dSpecify the code storage directory-ideaIdentifies whether the command comes from the idea plugin, for idea plugin development use, terminal execution please ignore [optional parameter]-styleSpecify filename naming style, gozero:lowercase,go_zero:underscore,GoZero:hump | |
model | Model layer code operationmysql generates model code from mysqlββ ddl specifies data source to generate model code for ddl fileββββ -src,s specifies the sql file source containing ddl, supports wildcard matchingββββ -dir,d specifies the code storage directoryββββ -style specifies the file name naming style, gozero: lowercase, go_zero: underscore, GoZero: camelββββ -cache,c whether to generate code With redis cache logic, bool valueββββ -idea identifies whether the command comes from the idea plug-in and is used for idea plug-in development. Please ignore the terminal execution [optional parameter]<br/ >ββdatasourceSpecify data source to generate model code from database linkββββ -urlSpecify database linkββββ - table,t specifies the table name, supports wildcardsββββ -dir,d specifies the code storage directoryββββ -style specifies the file Name naming style, gozero: lowercase, go_zero: underscore, GoZero: camel caseββββ -cache,c whether the generated code has redis cache logic, bool valueββββ -idea identifies whether the command comes from the idea plug-in and is used for the development and use of the idea plug-in. Please ignore the [optional parameter] for terminal execution.mongo generates model code from mongo< br/>ββ-type,t specifies the name of Go Typeββ -cache,c whether the generated code has redis cache logic, bool value, default noβ β -dir,d specifies the code generation directoryββ -style refers to Specify the file name naming style, gozero: lowercase, go_zero: underscore, GoZero: camel case | 
model generationβ
| Name | Function | Example | 
|---|---|---|
mysql | Generate model code from mysql ββ ddl Specify data source to generate model code for ddl fileββββ -src,s Specify include The sql file source of ddl supports wildcard matchingββββ -dir,d specifies the code storage directoryββββ -style specifies the file name Naming style, gozero: lowercase, go_zero: underscore, GoZero: camel caseββββ -cache,c whether the generated code has redis cache logic, bool valueββ ββ -idea identifies whether the command comes from the idea plug-in and is used for the development and use of the idea plug-in, please ignore the terminal execution [optional parameter]ββ datasource specifies that the data source is generated from the database link model codeββββ -url specifies the database linkββββ -table,t specifies the table name, supports wildcards&emsp ;βββ -dir,d specifies the code storage directoryββββ -style specifies the file name naming style, gozero: lowercase, go_zero: underscore, GoZero: camel case ββββ -cache,c whether the generated code has redis cache logic, bool valueββββ -idea identifies whether the command comes from idea Plug-in, used for the development and use of idea plug-in, please ignore the terminal execution [optional parameter] | |
mongo | Generate model code from mongo ββ -type,t Specify Go Type nameββ -cache,c Whether the generated code has redis cache logic, bool value, default noββ -dir,d specifies the code generation directoryββ -style specifies the file name naming style, gozero: lowercase, go_zero: underscore, GoZero :Hump | 
template operationβ
| Name | Function | Example | 
|---|---|---|
init | Save api/rpc/model template | goctl template init | 
clean | clear cache template | goctl template clean | 
update | update template-category,c specify the group name to be updated api/rpc/model | goctl template update -c api | 
revert | restore the specified template file-category,c specify the name of the group to be updated api/rpc/model-name,n specify the name of the template file | 
config configuration file generationβ
| Name | Function | Example | 
|---|---|---|
-path,p | specify the configuration file directory | goctl config -p user | 
docker generates Dockerfileβ
| Name | Function | Example | 
|---|---|---|
-go | specify main function file | |
-port | Specify the exposed port | 
upgrade goctl to update to the latest versionβ
kube Generate k8s deployment filesβ
deploy k8s deploymenetβ
| Name | Function | Example | 
|---|---|---|
-name | service name | |
-namespace | specify k8s namespace | |
-image | specify the image name | |
-secret | Specifies the k8s secret for getting the image | |
-requestCpu | specify the default cpu allocation | |
-requestMem | specify the default memory allocation | |
-limitCpu | specify the maximum cpu allocation | |
-limitMem | specify the maximum memory allocation | |
-o | deployment.yaml output directory | |
-replicas | specify the number of replicas | |
-revisions | specify the number of records to keep for the release | |
-port | specify the service port | |
-nodePort | specifies the port to which the service is exposed | |
-minReplicas | specify the minimum number of replicas | |
-maxReplicas | specify the maximum number of replicas |