Add debug output to Exists
This commit is contained in:
parent
6c299c82cb
commit
7ae9af702f
1 changed files with 7 additions and 1 deletions
|
@ -6,8 +6,9 @@
|
|||
func {{$tableNameSingular}}Exists(exec boil.Executor, {{$pkArgs}}) (bool, error) {
|
||||
var exists bool
|
||||
|
||||
sql := `select exists(select 1 from "{{.Table.Name}}" where {{whereClause 1 .Table.PKey.Columns}} limit 1)`
|
||||
row := exec.QueryRow(
|
||||
`select exists(select 1 from "{{.Table.Name}}" where {{whereClause 1 .Table.PKey.Columns}} limit 1)`,
|
||||
sql,
|
||||
{{$pkNames | join ", "}},
|
||||
)
|
||||
|
||||
|
@ -16,6 +17,11 @@ func {{$tableNameSingular}}Exists(exec boil.Executor, {{$pkArgs}}) (bool, error)
|
|||
return false, fmt.Errorf("{{.PkgName}}: unable to check if {{.Table.Name}} exists: %v", err)
|
||||
}
|
||||
|
||||
if boil.DebugMode {
|
||||
fmt.Fprintln(boil.DebugWriter, sql)
|
||||
fmt.Fprintln(boil.DebugWriter, {{$pkNames | join ", "}})
|
||||
}
|
||||
|
||||
return exists, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue