Cleanup / audit

This commit is contained in:
jdl
2026-06-25 13:35:41 +02:00
parent 9a0beaf9cb
commit 58adb4b2a6
8 changed files with 49 additions and 25 deletions

View File

@@ -139,14 +139,11 @@ func {{.LowerType}}_Get(
tx TX,
{{.PKFunctionArgs -}}
) (
row *{{.Type}},
row {{.Type}},
err error,
) {
row = &{{.Type}}{}
r := tx.QueryRow("{{.GetQuery}}", {{.DeleteArgs}})
if err = r.Scan({{.ScanArgs}}); err != nil {
row = nil
}
err = r.Scan({{.ScanArgs}})
return
}
@@ -155,14 +152,11 @@ func {{.LowerType}}_GetWhere(
query string,
args ...any,
) (
row *{{.Type}},
row {{.Type}},
err error,
) {
row = &{{.Type}}{}
r := tx.QueryRow(query, args...)
if err = r.Scan({{.ScanArgs}}); err != nil {
row = nil
}
err = r.Scan({{.ScanArgs}})
return
}
@@ -176,7 +170,7 @@ func {{.LowerType}}_Iterate(
rows, err := tx.Query(query, args...)
if err != nil {
return func(yield func({{.Type}}, error) bool) {
yield(nil, err)
yield({{.Type}}{}, err)
}
}