snapshot of https://github.com/sqlc-dev/sqlc.git (main, 2026-09-16; blobs > 131072B omitted)
Some checks failed
kotlin / test (push) Has been skipped
python / test (push) Has been skipped
typescript / test (push) Has been skipped
go / build darwin/amd64 (push) Has been cancelled
go / build linux/amd64 (push) Has been cancelled
go / build windows/amd64 (push) Has been cancelled
go / build darwin/arm64 (push) Has been cancelled
go / build linux/arm64 (push) Has been cancelled
go / build windows/arm64 (push) Has been cancelled
go / test (push) Has been cancelled
go / vuln_check (push) Has been cancelled
Some checks failed
kotlin / test (push) Has been skipped
python / test (push) Has been skipped
typescript / test (push) Has been skipped
go / build darwin/amd64 (push) Has been cancelled
go / build linux/amd64 (push) Has been cancelled
go / build windows/amd64 (push) Has been cancelled
go / build darwin/arm64 (push) Has been cancelled
go / build linux/arm64 (push) Has been cancelled
go / build windows/arm64 (push) Has been cancelled
go / test (push) Has been cancelled
go / vuln_check (push) Has been cancelled
This commit is contained in:
63
internal/codegen/golang/templates/stdlib/interfaceCode.tmpl
Normal file
63
internal/codegen/golang/templates/stdlib/interfaceCode.tmpl
Normal file
@@ -0,0 +1,63 @@
|
||||
{{define "interfaceCodeStd"}}
|
||||
type Querier interface {
|
||||
{{- $dbtxParam := .EmitMethodsWithDBArgument -}}
|
||||
{{- range .GoQueries}}
|
||||
{{- if and (eq .Cmd ":one") ($dbtxParam) }}
|
||||
{{range .Comments}}//{{.}}
|
||||
{{end -}}
|
||||
{{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) ({{.Ret.DefineType}}, error)
|
||||
{{- else if eq .Cmd ":one"}}
|
||||
{{range .Comments}}//{{.}}
|
||||
{{end -}}
|
||||
{{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) ({{.Ret.DefineType}}, error)
|
||||
{{- end}}
|
||||
{{- if and (eq .Cmd ":many") ($dbtxParam) }}
|
||||
{{range .Comments}}//{{.}}
|
||||
{{end -}}
|
||||
{{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) ([]{{.Ret.DefineType}}, error)
|
||||
{{- else if eq .Cmd ":many"}}
|
||||
{{range .Comments}}//{{.}}
|
||||
{{end -}}
|
||||
{{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) ([]{{.Ret.DefineType}}, error)
|
||||
{{- end}}
|
||||
{{- if and (eq .Cmd ":exec") ($dbtxParam) }}
|
||||
{{range .Comments}}//{{.}}
|
||||
{{end -}}
|
||||
{{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) error
|
||||
{{- else if eq .Cmd ":exec"}}
|
||||
{{range .Comments}}//{{.}}
|
||||
{{end -}}
|
||||
{{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) error
|
||||
{{- end}}
|
||||
{{- if and (eq .Cmd ":execrows") ($dbtxParam) }}
|
||||
{{range .Comments}}//{{.}}
|
||||
{{end -}}
|
||||
{{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) (int64, error)
|
||||
{{- else if eq .Cmd ":execrows"}}
|
||||
{{range .Comments}}//{{.}}
|
||||
{{end -}}
|
||||
{{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) (int64, error)
|
||||
{{- end}}
|
||||
{{- if and (eq .Cmd ":execlastid") ($dbtxParam) }}
|
||||
{{range .Comments}}//{{.}}
|
||||
{{end -}}
|
||||
{{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) (int64, error)
|
||||
{{- else if eq .Cmd ":execlastid"}}
|
||||
{{range .Comments}}//{{.}}
|
||||
{{end -}}
|
||||
{{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) (int64, error)
|
||||
{{- end}}
|
||||
{{- if and (eq .Cmd ":execresult") ($dbtxParam) }}
|
||||
{{range .Comments}}//{{.}}
|
||||
{{end -}}
|
||||
{{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) (sql.Result, error)
|
||||
{{- else if eq .Cmd ":execresult"}}
|
||||
{{range .Comments}}//{{.}}
|
||||
{{end -}}
|
||||
{{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) (sql.Result, error)
|
||||
{{- end}}
|
||||
{{- end}}
|
||||
}
|
||||
|
||||
var _ Querier = (*Queries)(nil)
|
||||
{{end}}
|
||||
Reference in New Issue
Block a user