sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

Export github.com/sqlc-dev/sqlc/internal/plugin

Open mikeschinkel opened this issue 1 year ago • 1 comments

What do you want to change?

In looking at the sample plugin is seems that the sample given uses two internal packages that we cannot use externally.

I read the related issue #2395 but that focused on code generation and not on the plugin package. I get that you expect the code generation code to change and thus don't want to expose it, but is that the same for the core plugin interface too?

Even if you do plan to change it, could you not create new version of plugin.GenerateRequest so you can maintain the existing one to support older plugins? If yes, then making them plugin public shouldn't be an issue, no?

What database engines need to be changed?

No response

What programming language backends need to be changed?

No response

mikeschinkel avatar Jun 15 '24 17:06 mikeschinkel

I'm running into the same issue. I want to make a plugin so I currently have to fork sqlc when I just need the plugin.GenerateRequest|Response

delaneyj avatar Jun 30 '24 22:06 delaneyj

@mikeschinkel

in the meantime I'm now using a Taskfile.yml to do the automation to use outside of sqlc

  sqlc-pb-update:
    dir: sqlc-gen-zombiezen/pb/plugin
    cmds:
      - wget -Nc -q --show-progress https://raw.githubusercontent.com/sqlc-dev/sqlc/main/internal/plugin/codegen.pb.go
      - wget -Nc -q --show-progress https://raw.githubusercontent.com/sqlc-dev/sqlc/main/internal/plugin/codegen_grpc.pb.go

  sqlc:
    dir: sqlc-gen-zombiezen
    sources:
      - "**/*.go"
      - "**/*.tpl"
    deps:
      - sqlc-pb-update
    cmds:
      - go install

delaneyj avatar Jul 01 '24 16:07 delaneyj

@delaneyj — Thanks. How are you running Taskfile.yml?

mikeschinkel avatar Jul 01 '24 16:07 mikeschinkel

task sqlc -w note this is just part of the taskfile... task --init to make a new file. https://taskfile.dev/usage/ for more details.

delaneyj avatar Jul 01 '24 22:07 delaneyj

@delaneyj — Thanks!

mikeschinkel avatar Jul 01 '24 23:07 mikeschinkel

The plugin package won't be moved in this repository, but it is exported in the https://github.com/sqlc-dev/plugin-sdk-go package, which should be used when building sqlc plugins in Go.

That package is a bit out of date, but I don't think the plugin interface has changed in the last few minor versions. I'll make sure to update it for the next release.

kyleconroy avatar Jul 02 '24 06:07 kyleconroy