2020-11-29 20:10:59 +00:00
|
|
|
{{- define "signature" -}}
|
|
|
|
Find_{{ .Suffix }}({{ ctxparam .Args }}) (
|
|
|
|
{{ param .Row }}, err error)
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- define "invoke" -}}
|
|
|
|
Find_{{ .Suffix }}({{ ctxarg .Args }})
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- define "body" }}
|
|
|
|
{{ embedplaceholders .Info }}
|
|
|
|
{{ embedsql .Info "__embed_stmt" }}
|
|
|
|
|
|
|
|
var __values []interface{}
|
|
|
|
{{ embedvalues .Args "__values" }}
|
|
|
|
|
|
|
|
var __stmt = __sqlbundle_Render(obj.dialect, __embed_stmt)
|
|
|
|
obj.logStmt(__stmt, __values...)
|
|
|
|
|
|
|
|
{{ init .Row }}
|
2020-11-29 20:38:32 +00:00
|
|
|
err = obj.queryRowContext(ctx, __stmt, __values...).Scan({{ addrof (flatten .Row) }})
|
2020-11-29 20:10:59 +00:00
|
|
|
if err == sql.ErrNoRows {
|
|
|
|
return {{ zero .Row }}, nil
|
|
|
|
}
|
|
|
|
if err != nil {
|
|
|
|
return {{ zero .Row }}, obj.makeErr(err)
|
|
|
|
}
|
|
|
|
return {{ arg .Row }}, nil
|
|
|
|
{{ end -}}
|