Skip to content

Commit

Permalink
Fix silly bug which break uint id's
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardLindhout committed May 7, 2020
1 parent 6a0e2c5 commit 230d023
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,21 +364,21 @@ func enhanceModelsWithFields(enums []*Enum, schema *ast.Schema, cfg *config.Conf
isRelation := fieldDef.Kind == ast.Object || fieldDef.Kind == ast.InputObject

shortType := getShortType(typ.String())
isString := strings.Contains(strings.ToLower(shortType), "string")

isPrimaryID := golangName == "ID"

// get sqlboiler information of the field
boilerField := findBoilerFieldOrForeignKey(m.BoilerModel.Fields, golangName, isRelation)
isString := strings.Contains(boilerField.Type, "string")
isNumberID := strings.Contains(golangName, "ID") && !isString
isPrimaryNumberID := isPrimaryID && !isString

isPrimaryStringID := isPrimaryID && isString
// enable simpler code in resolvers

if isPrimaryStringID {
m.HasStringPrimaryID = isPrimaryStringID
}

// get sqlboiler information of the field
boilerField := findBoilerFieldOrForeignKey(m.BoilerModel.Fields, golangName, isRelation)
if isPrimaryNumberID || isPrimaryStringID {
m.PrimaryKeyType = boilerField.Type
}
Expand Down

0 comments on commit 230d023

Please sign in to comment.