storj/satellite/satellitedb/dbx/templates/golang.get-last.tmpl
JT Olio ea2f39ca7f satellite/dbx: add retries for QueryRowContext-based operations
Change-Id: Ie2527b673dd4ce5250cf5c0cbf8f14921262f665
2020-11-29 18:09:46 -07:00

21 lines
519 B
Cheetah

{{- 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 }}
err = obj.queryRowContext(ctx, __stmt, pk).Scan({{ addrof (flatten .Return) }})
if err != nil {
return {{ zero .Return }}, obj.makeErr(err)
}
return {{ arg .Return }}, nil
{{ end -}}