Skip to content

Commit 031f5db

Browse files
committed
Updated casing config options and added editorconfig
1 parent c699af2 commit 031f5db

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type Mapping struct {
4747
var CurrentConfig *Config = nil
4848

4949
// set in ReadConfig
50-
var loadedConfigLocation string = ""
50+
var loadedConfigLocation = ""
5151

5252
// GetAndValidateConfig gets configuration from viper
5353
func GetAndValidateConfig() (*Config, error) {
@@ -71,7 +71,7 @@ func GetAndValidateConfig() (*Config, error) {
7171
config.ModelTemplate = joinIfRelative(config.PathBase, config.ModelTemplate)
7272
config.OutputFolder = joinIfRelative(config.PathBase, config.OutputFolder)
7373

74-
if !contains(ValidCase, strings.ToLower(config.GeneratedFileCase)) {
74+
if !contains(ValidCaseNormalized, strings.ToLower(config.GeneratedFileCase)) {
7575
return nil, fmt.Errorf(" '%s' is not valid case (maybe GeneratedFileCase is missing)", config.GeneratedFileCase)
7676
}
7777

src/generator.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import (
1717
const processorsFolder = "processors"
1818
const modelsFolder = "models"
1919

20+
var ValidCaseNormalized = []string{"snakecase", "camelcase", "pascalcase"}
21+
2022
func Generate(routines []Routine, config *Config) error {
2123
fileHashes, err := generateFileHashes(config.OutputFolder)
2224
if err != nil {
@@ -278,15 +280,13 @@ func generateFileHashes(outputFolder string) (*map[string]string, error) {
278280

279281
}
280282

281-
var ValidCase = []string{"snake", "lcamel", "ucamel"}
282-
283283
func changeCase(str string, desiredCase string) string {
284284
switch strings.ToLower(desiredCase) {
285-
case "ucamel":
285+
case "pascalCase":
286286
return strcase.UpperCamelCase(str)
287-
case "lcamel":
287+
case "camelCase":
288288
return strcase.LowerCamelCase(str)
289-
case "snake":
289+
case "snakeCase":
290290
return strcase.SnakeCase(str)
291291
default:
292292

0 commit comments

Comments
 (0)