Documentation
¶
Index ¶
- Constants
- Variables
- func GetHomeDir() string
- func InitConfig() error
- func InitGlobalVar() error
- func IsFileExist(name string) bool
- func PrintImportantVars()
- type Config
- type TemplateConfig
- func (tmplCfg *TemplateConfig) ClientRelativeDirs(group, serviceName string) []string
- func (tmplCfg *TemplateConfig) ClientTargetAbsDir(serviceGroup, serviceName string) string
- func (tmplCfg *TemplateConfig) ClientTargetAbsDir0(packagePath string) string
- func (tmplCfg *TemplateConfig) ClientTmplAbsDir() string
- func (tmplCfg *TemplateConfig) GetFileName(tmplName string) string
- func (tmplCfg *TemplateConfig) Init() error
- func (tmplCfg *TemplateConfig) JoinGoPackage(serviceGroup, protoName string) string
- func (tmplCfg *TemplateConfig) ProcessFilePath(targetRootDir, tmplFilePath, rootTmplPath, tmplName string) string
- func (tmplCfg *TemplateConfig) ProjectTargetAbsDir(serviceGroup string, projectName string) string
- func (tmplCfg *TemplateConfig) ProjectTmplAbsDir() string
- func (tmplCfg *TemplateConfig) ProtoTargetAbsPath(serviceGroup, protoPath string) string
- func (tmplCfg *TemplateConfig) ProtoTmplAbsPath() string
- func (tmplCfg *TemplateConfig) ProtoTmplName() string
- func (tmplCfg *TemplateConfig) ServerRelativeDirs(group, serviceName string) []string
- func (tmplCfg *TemplateConfig) ServerTargetAbsPath(serviceGroup, serviceName string) string
- func (tmplCfg *TemplateConfig) ServerTmplAbsDir() string
- func (tmplCfg *TemplateConfig) TempFileExtSuffix() string
Constants ¶
View Source
const ( ProtoFileSuffix = ".proto" GroupNameVar = "{GROUP_NAME}" ServiceNameVar = "{SERVICE_NAME}" )
Variables ¶
View Source
var (
GlobalConfig = Config{}
)
Functions ¶
func GetHomeDir ¶
func GetHomeDir() string
func InitConfig ¶ added in v0.1.1
func InitConfig() error
func InitGlobalVar ¶
func InitGlobalVar() error
func IsFileExist ¶ added in v0.1.1
func PrintImportantVars ¶
func PrintImportantVars()
Types ¶
type Config ¶ added in v0.1.1
type Config struct {
Debug bool `yaml:"Debug" env:"name=GCTL_DEBUG"`
// @desc: Database URI
// MySQL: mysql://username:password@tcp(ip:port)/database
// Postgres: postgres://username:password@ip:port/database or "user=astaxie password=astaxie dbname=test sslmode=disable"
// SQLite: sqlite://username:password@ip:port/database
DBURI string `yaml:"DbURI" env:"name=GCTL_DB_URI"`
// @desc: The name of the csv file to store the service port and errcode when the database is not used.
CsvFile string `yaml:"CsvFile" env:"name=GCTL_CSV_FILE;default=gctl_service_settings.csv"`
EnableAssignPort bool `yaml:"EnableAssignPort" env:"name=GCTL_ENABLE_ASSIGN_PORT;default=false"`
EnableAssignErrcode bool `yaml:"EnableAssignErrcode" env:"name=GCTL_ENABLE_ASSIGN_ERRCODE;default=false"`
SvcErrcodeInterval int `yaml:"SvcErrcodeInterval" env:"name=GCTL_SVC_ERRCODE_INTERVAL;default=1000"`
SvcPortInterval int `yaml:"SvcPortInterval" env:"name=GCTL_SVC_PORT_INTERVAL;default=10"`
DefaultStartingPort int `yaml:"DefaultStartingPort" env:"name=GCTL_DEFAULT_STARTING_PORT;default=10000"`
DefaultStartingErrcode int `yaml:"DefaultStartingErrcode" env:"name=GCTL_DEFAULT_STARTING_ERRCODE;default=100000"`
SvcGroupInitPortMap map[string]int `yaml:"SvcGroupInitPortMap" env:"name=GCTL_SVC_GROUP_INIT_PORT_MAP"`
SvcGroupInitErrcodeMap map[string]int `yaml:"SvcGroupInitErrcodeMap" env:"name=GCTL_SVC_GROUP_INIT_ERRCODE_MAP"`
TargetBaseDir string `yaml:"TargetBaseDir" env:"name=GCTL_TARGET_BASE_DIR"`
DefaultSvcGroup string `yaml:"DefaultServiceGroup" env:"name=GCTL_DEFAULT_SVC_GROUP"`
GoModulePrefix string `yaml:"GoModulePrefix" env:"name=GCTL_MODULE_PREFIX"`
OnceFiles []string `yaml:"OnceFiles" env:"name=GCTL_ONCE_FILES;default=.gitignore,go.mod,.editorconfig,README.md,Dockerfile,Makefile"`
ProtoPaths []string `yaml:"ProtoPaths" env:"name=GCTL_PROTO_PATHS"`
ProtoCentralRepoPath string `yaml:"ProtoCentralRepoPath" env:"name=GCTL_PROTO_CENTRAL_REPO_PATH"`
SwaggerCentralRepoPath string `yaml:"SwaggerCentralRepoPath" env:"name=GCTL_SWAGGER_CENTRAL_REPO_PATH"`
TemplatesBaseDir string `yaml:"TemplatesBaseDir" env:"name=GCTL_TEMPLATES_BASE_DIR"`
TemplatesConf *TemplateConfig `yaml:"TemplatesConf"`
// @desc: usage of yaml
// ProtoPlugins:
// - "--go_out=paths=source_relative:."
// - "--go-grpc_out=paths=source_relative:."
// - "--go-field_out=paths=source_relative,include_prefix=Model:."
ProtoPlugins []string `yaml:"ProtoPlugins"`
}
func (*Config) IsRelativePath ¶ added in v0.1.1
type TemplateConfig ¶ added in v0.1.1
type TemplateConfig struct {
Target struct {
RelativeDir struct {
Proto []string `yaml:"proto"`
Client []string `yaml:"client"`
Server []string `yaml:"server"`
} `yaml:"relativeDir"`
} `yaml:"target"`
Template struct {
FilesFormatSuffix string `yaml:"filesFormatSuffix"`
ProtoFilename string `yaml:"protoFilename"`
ServiceFileName string `yaml:"serviceFileName"`
RelativeDir struct {
Project []string `yaml:"project"`
Proto []string `yaml:"proto"`
Client []string `yaml:"client"`
Server []string `yaml:"server"`
} `yaml:"relativeDir"`
} `yaml:"template"`
}
func GetTmplFilesConf ¶ added in v0.1.1
func GetTmplFilesConf() (*TemplateConfig, error)
func InitTemplateCfg ¶ added in v0.1.1
func InitTemplateCfg() (*TemplateConfig, error)
func (*TemplateConfig) ClientRelativeDirs ¶ added in v0.1.1
func (tmplCfg *TemplateConfig) ClientRelativeDirs(group, serviceName string) []string
func (*TemplateConfig) ClientTargetAbsDir ¶ added in v0.1.1
func (tmplCfg *TemplateConfig) ClientTargetAbsDir(serviceGroup, serviceName string) string
func (*TemplateConfig) ClientTargetAbsDir0 ¶ added in v0.1.1
func (tmplCfg *TemplateConfig) ClientTargetAbsDir0(packagePath string) string
func (*TemplateConfig) ClientTmplAbsDir ¶ added in v0.1.1
func (tmplCfg *TemplateConfig) ClientTmplAbsDir() string
func (*TemplateConfig) GetFileName ¶ added in v0.1.1
func (tmplCfg *TemplateConfig) GetFileName(tmplName string) string
func (*TemplateConfig) Init ¶ added in v0.1.1
func (tmplCfg *TemplateConfig) Init() error
func (*TemplateConfig) JoinGoPackage ¶ added in v0.1.1
func (tmplCfg *TemplateConfig) JoinGoPackage(serviceGroup, protoName string) string
func (*TemplateConfig) ProcessFilePath ¶ added in v0.1.1
func (tmplCfg *TemplateConfig) ProcessFilePath(targetRootDir, tmplFilePath, rootTmplPath, tmplName string) string
func (*TemplateConfig) ProjectTargetAbsDir ¶ added in v0.1.1
func (tmplCfg *TemplateConfig) ProjectTargetAbsDir(serviceGroup string, projectName string) string
func (*TemplateConfig) ProjectTmplAbsDir ¶ added in v0.1.1
func (tmplCfg *TemplateConfig) ProjectTmplAbsDir() string
func (*TemplateConfig) ProtoTargetAbsPath ¶ added in v0.1.1
func (tmplCfg *TemplateConfig) ProtoTargetAbsPath(serviceGroup, protoPath string) string
func (*TemplateConfig) ProtoTmplAbsPath ¶ added in v0.1.1
func (tmplCfg *TemplateConfig) ProtoTmplAbsPath() string
func (*TemplateConfig) ProtoTmplName ¶ added in v0.1.1
func (tmplCfg *TemplateConfig) ProtoTmplName() string
func (*TemplateConfig) ServerRelativeDirs ¶ added in v0.1.1
func (tmplCfg *TemplateConfig) ServerRelativeDirs(group, serviceName string) []string
func (*TemplateConfig) ServerTargetAbsPath ¶ added in v0.1.1
func (tmplCfg *TemplateConfig) ServerTargetAbsPath(serviceGroup, serviceName string) string
func (*TemplateConfig) ServerTmplAbsDir ¶ added in v0.1.1
func (tmplCfg *TemplateConfig) ServerTmplAbsDir() string
func (*TemplateConfig) TempFileExtSuffix ¶ added in v0.1.1
func (tmplCfg *TemplateConfig) TempFileExtSuffix() string
Click to show internal directories.
Click to hide internal directories.