config

package
v0.0.0-...-115e584 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

README

使用方法

目前可通过在生成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

支持的属性值

格式化符由go,zero组成,如常见的三种格式化如下:

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

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

格式化符 格式化结果 说明
gozero welcometogozero 小写
goZero welcomeToGoZero 驼峰
go_zero welcome_to_go_zero snake
Go#zero Welcome#to#go#zero #号分割Title类型
GOZERO WELCOMETOGOZERO 大写
_go#zero_ _welcome#to#go#zero_ 下划线做前后缀,并且#分割

错误格式化符示例

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

Documentation

Index

Constants

View Source
const (
	// DefaultFormat defines a default naming style
	DefaultFormat = "gozero"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// NamingFormat is used to define the naming format of the generated file name.
	// just like time formatting, you can specify the formatting style through the
	// two format characters go, and zero. for example: snake format you can
	// define as go_zero, camel case format you can it is defined as goZero,
	// and even split characters can be specified, such as go#zero. in theory,
	// any combination can be used, but the prerequisite must meet the naming conventions
	// of each operating system file name.
	// Note: NamingFormat is based on snake or camel string
	NamingFormat string `yaml:"namingFormat"`
}

Config defines the file naming style

func NewConfig

func NewConfig(format string) (*Config, error)

NewConfig creates an instance for Config

Jump to

Keyboard shortcuts

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