Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardLindhout committed Dec 30, 2020
1 parent d4dd0e3 commit b9b7f7a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
1 change: 0 additions & 1 deletion convert_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,6 @@ func getConvertConfig(enums []*Enum, model *Model, field *Field) (cc ConvertConf
cc.ToBoiler = getToBoiler(getBoilerTypeAsText(boilType), getGraphTypeAsText(graphType))
cc.ToGraphQL = getToGraphQL(getBoilerTypeAsText(boilType), getGraphTypeAsText(graphType))
}

}

// fmt.Println("boilType for", field.Name, ":", boilType)
Expand Down
3 changes: 0 additions & 3 deletions sqlboiler_graphql_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,9 +556,6 @@ func toGraphQLType(fieldName, boilerType string) string {
return "Int"
}

// E.g. UserSlice
boilerType = strings.TrimSuffix(boilerType, "Slice")

// e.g. null.JSON let user define how it looks with their own struct
return strcase.ToCamel(fieldName)
}
Expand Down
8 changes: 5 additions & 3 deletions templates/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
"strings"
"text/template"

"github.com/rs/zerolog/log"

"github.com/iancoleman/strcase"

"golang.org/x/tools/imports"
Expand All @@ -38,7 +40,7 @@ type Options struct {
Data interface{}
}

func init() {
func init() { // nolint:gochecknoinits
strcase.ConfigureAcronym("QR", "qr")
strcase.ConfigureAcronym("KVK", "kvk")
strcase.ConfigureAcronym("URL", "url")
Expand All @@ -51,7 +53,7 @@ func WriteTemplateFile(fileName string, cfg Options) error {
fSet := token.NewFileSet()
node, err := parser.ParseFile(fSet, "src.go", string(importFixedContent), 0)
if err != nil {
fmt.Println("could not parse golang file", err)
log.Error().Err(err).Msg("could not parse golang file")
}

ast.Inspect(node, func(n ast.Node) bool {
Expand All @@ -66,7 +68,7 @@ func WriteTemplateFile(fileName string, cfg Options) error {
f, writeError := os.Create(fileName)
defer func() {
if err := f.Close(); err != nil {
fmt.Println("could not close file")
log.Error().Err(err).Msg("could not close file")
}
}()
if err := printer.Fprint(f, fSet, node); err != nil {
Expand Down

0 comments on commit b9b7f7a

Please sign in to comment.