Skip to content

Commit

Permalink
fix copyfrom methods on interface not matching generated methods (#1424)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdulin committed Feb 11, 2022
1 parent fab641e commit 0c0a35e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
4 changes: 2 additions & 2 deletions internal/codegen/golang/templates/pgx/interfaceCode.tmpl
Expand Up @@ -28,9 +28,9 @@
{{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) (pgconn.CommandTag, error)
{{- end}}
{{- if and (eq .Cmd ":copyfrom") ($dbtxParam) }}
{{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.Pair}}) (int64, error)
{{.MethodName}}(ctx context.Context, db DBTX, {{.Arg.SlicePair}}) (int64, error)
{{- else if eq .Cmd ":copyfrom" }}
{{.MethodName}}(ctx context.Context, {{.Arg.Pair}}) (int64, error)
{{.MethodName}}(ctx context.Context, {{.Arg.SlicePair}}) (int64, error)
{{- end}}
{{- end}}
}
Expand Down
15 changes: 15 additions & 0 deletions internal/endtoend/testdata/copyfrom/postgresql/pgx/go/querier.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion internal/endtoend/testdata/copyfrom/postgresql/pgx/sqlc.json
Expand Up @@ -7,7 +7,8 @@
"sql_package": "pgx/v4",
"name": "querytest",
"schema": "query.sql",
"queries": "query.sql"
"queries": "query.sql",
"emit_interface": true
}
]
}

0 comments on commit 0c0a35e

Please sign in to comment.