package
1.1.7
Repository: https://github.com/melonwool/go-zero.git
Documentation: pkg.go.dev

# README

配置项管理

名称是否可选说明
namingFormatYES文件名称格式化符

naming-format

namingFormat可以用于对生成代码的文件名称进行格式化,和日期格式化符(yyyy-MM-dd)类似,在代码生成时可以根据这些配置项的格式化符进行格式化。

格式化符(gozero)

格式化符有go,zero组成,如常见的三种格式化风格你可以这样编写:

  • lower: gozero
  • camel: goZero
  • snake: go_zero

常见格式化符生成示例 源字符:welcome_to_go_zero

格式化符格式化结果说明
gozerowelcometogozero小写
goZerowelcomeToGoZero驼峰
go_zerowelcome_to_go_zerosnake
Go#zeroWelcome#to#go#zero#号分割Title类型
GOZEROWELCOMETOGOZERO大写
_go#zero__welcome#to#go#zero_下划线做前后缀,并且#分割

错误格式化符示例

  • go
  • gOZero
  • zero
  • goZEro
  • goZERo
  • goZeRo
  • tal

使用方法

目前可通过在生成api、rpc、model时通过--style参数指定format格式,如:

goctl api go test.api -dir . -style gozero
 goctl rpc proto -src test.proto -dir . -style go_zero
goctl model mysql datasource -url="" -table="*" -dir ./snake -style GoZero

默认值

当不指定-style时默认值为gozero

# Functions

NewConfig creates an instance for Config.

# Constants

DefaultFormat defines a default naming style.

# Structs

Config defines the file naming style.