Fix non-int comparisons
This commit is contained in:
parent
ab67fddac3
commit
6c13b63500
3 changed files with 32 additions and 26 deletions
|
@ -100,20 +100,23 @@ func (o *{{$tableNameSingular}}) Insert(exec boil.Executor, whitelist ... string
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ErrSyncFail
|
return ErrSyncFail
|
||||||
}
|
}
|
||||||
|
|
||||||
if lastID != 0 {
|
{{- $colName := index .Table.PKey.Columns 0 -}}
|
||||||
{{- $colName := index .Table.PKey.Columns 0 -}}
|
{{- $col := .Table.GetColumn $colName -}}
|
||||||
{{- $col := .Table.GetColumn $colName -}}
|
{{- $colTitled := $colName | singular | titleCase}}
|
||||||
{{- $colTitled := $colName | singular | titleCase}}
|
{{if eq 1 (len .Table.PKey.Columns)}}
|
||||||
o.{{$colTitled}} = {{$col.Type}}(lastID)
|
{{$cnames := .Table.Columns | filterColumnsByDefault true | columnNames}}
|
||||||
identifierCols = []interface{}{lastID}
|
{{if setInclude $colName $cnames}}
|
||||||
} else {
|
o.{{$colTitled}} = {{$col.Type}}(lastID)
|
||||||
identifierCols = []interface{}{
|
identifierCols = []interface{}{lastID}
|
||||||
{{range .Table.PKey.Columns -}}
|
{{end}}
|
||||||
o.{{. | singular | titleCase}},
|
{{else}}
|
||||||
{{end -}}
|
identifierCols = []interface{}{
|
||||||
}
|
{{range .Table.PKey.Columns -}}
|
||||||
|
o.{{. | singular | titleCase}},
|
||||||
|
{{end -}}
|
||||||
}
|
}
|
||||||
|
{{end}}
|
||||||
|
|
||||||
if lastID == 0 || len(cache.retMapping) != 1 || cache.retMapping[0] == {{$varNameSingular}}Mapping["{{$colTitled}}"] {
|
if lastID == 0 || len(cache.retMapping) != 1 || cache.retMapping[0] == {{$varNameSingular}}Mapping["{{$colTitled}}"] {
|
||||||
if boil.DebugMode {
|
if boil.DebugMode {
|
||||||
|
|
|
@ -142,19 +142,22 @@ func (o *{{$tableNameSingular}}) Upsert(exec boil.Executor, {{if ne .DriverName
|
||||||
return ErrSyncFail
|
return ErrSyncFail
|
||||||
}
|
}
|
||||||
|
|
||||||
if lastID != 0 {
|
{{- $colName := index .Table.PKey.Columns 0 -}}
|
||||||
{{- $colName := index .Table.PKey.Columns 0 -}}
|
{{- $col := .Table.GetColumn $colName -}}
|
||||||
{{- $col := .Table.GetColumn $colName -}}
|
{{- $colTitled := $colName | singular | titleCase}}
|
||||||
{{- $colTitled := $colName | singular | titleCase}}
|
{{if eq 1 (len .Table.PKey.Columns)}}
|
||||||
o.{{$colTitled}} = {{$col.Type}}(lastID)
|
{{$cnames := .Table.Columns | filterColumnsByDefault true | columnNames}}
|
||||||
identifierCols = []interface{}{lastID}
|
{{if setInclude $colName $cnames}}
|
||||||
} else {
|
o.{{$colTitled}} = {{$col.Type}}(lastID)
|
||||||
identifierCols = []interface{}{
|
identifierCols = []interface{}{lastID}
|
||||||
{{range .Table.PKey.Columns -}}
|
{{end}}
|
||||||
o.{{. | singular | titleCase}},
|
{{else}}
|
||||||
{{end -}}
|
identifierCols = []interface{}{
|
||||||
}
|
{{range .Table.PKey.Columns -}}
|
||||||
|
o.{{. | singular | titleCase}},
|
||||||
|
{{end -}}
|
||||||
}
|
}
|
||||||
|
{{end}}
|
||||||
|
|
||||||
if lastID == 0 || len(cache.retMapping) != 1 || cache.retMapping[0] == {{$varNameSingular}}Mapping["{{$colTitled}}"] {
|
if lastID == 0 || len(cache.retMapping) != 1 || cache.retMapping[0] == {{$varNameSingular}}Mapping["{{$colTitled}}"] {
|
||||||
if boil.DebugMode {
|
if boil.DebugMode {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
{{- $dot := .Dot -}}
|
{{- $dot := .Dot -}}
|
||||||
{{- with .Rel -}}
|
{{- with .Rel -}}
|
||||||
{{- $varNameSingular := .ForeignKey.Table | singular | camelCase -}}
|
{{- $varNameSingular := .ForeignKey.Table | singular | camelCase -}}
|
||||||
{{- $foreignVarNameSingular := .ForeignKey.ForeignTable | singular | camelCase}}
|
{{- $foreignVarNameSingular := .ForeignKey.ForeignTable | singular | camelCase -}}
|
||||||
{{- $foreignTable := getTable $dot.Tables .ForeignKey.ForeignTable -}}
|
{{- $foreignTable := getTable $dot.Tables .ForeignKey.ForeignTable -}}
|
||||||
{{- $foreignTableFKeyCol := $foreignTable.GetColumn .ForeignKey.ForeignColumn -}}
|
{{- $foreignTableFKeyCol := $foreignTable.GetColumn .ForeignKey.ForeignColumn -}}
|
||||||
{{- $usesBytes := eq "[]byte" $foreignTableFKeyCol.Type -}}
|
{{- $usesBytes := eq "[]byte" $foreignTableFKeyCol.Type -}}
|
||||||
|
|
Loading…
Reference in a new issue