2020-11-29 20:10:59 +00:00
|
|
|
{{- define "signature" -}}
|
|
|
|
getLast{{ .Return.Type }}(ctx context.Context,
|
|
|
|
pk int64) (
|
|
|
|
{{ param .Return }}, err error)
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- define "body" -}}
|
|
|
|
{{ embedplaceholders .Info }}
|
|
|
|
{{ embedsql .Info "__embed_stmt" }}
|
|
|
|
|
|
|
|
var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt)
|
|
|
|
obj.logStmt(__stmt, pk)
|
|
|
|
|
|
|
|
{{ init .Return }}
|
2020-11-29 20:38:32 +00:00
|
|
|
err = obj.queryRowContext(ctx, __stmt, pk).Scan({{ addrof (flatten .Return) }})
|
2020-11-29 20:10:59 +00:00
|
|
|
if err != nil {
|
|
|
|
return {{ zero .Return }}, obj.makeErr(err)
|
|
|
|
}
|
|
|
|
return {{ arg .Return }}, nil
|
|
|
|
{{ end -}}
|