diff --git a/go.mod b/go.mod index 37a4c6d..f3c06bd 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,18 @@ module github.com/sqlc-dev/sqlc-gen-go go 1.21.3 -require github.com/fatih/structtag v1.2.0 // indirect +require ( + github.com/fatih/structtag v1.2.0 + github.com/google/go-cmp v0.5.9 + github.com/jinzhu/inflection v1.0.0 +) + +require ( + github.com/golang/protobuf v1.5.3 // indirect + golang.org/x/net v0.14.0 // indirect + golang.org/x/sys v0.11.0 // indirect + golang.org/x/text v0.12.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/grpc v1.59.0 // indirect + google.golang.org/protobuf v1.31.0 // indirect +) diff --git a/go.sum b/go.sum index e2c02dc..92cc22a 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,27 @@ github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/sqlc-dev/sqlc-go v1.22.1-0.20231102170509-ee94c710d92e h1:fgvOWVSJLVvl1ETExPEw2okhTj2kbxvAQ5ECLrAtWbQ= +github.com/sqlc-dev/sqlc-go v1.22.1-0.20231102170509-ee94c710d92e/go.mod h1:SXs+GYtPBUfDJQWSOvcJesiAwj4HNfigK7EwzwpHNPk= +golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= +golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= diff --git a/internal/field.go b/internal/field.go index ce0e8b7..cf48342 100644 --- a/internal/field.go +++ b/internal/field.go @@ -7,7 +7,7 @@ import ( "strings" "github.com/sqlc-dev/sqlc-gen-go/internal/opts" - "buf.build/gen/go/sqlc/sqlc/protocolbuffers/go/protos/plugin" + "github.com/sqlc-dev/sqlc-go/plugin" ) type Field struct { diff --git a/internal/gen.go b/internal/gen.go index 9302e81..aacf330 100644 --- a/internal/gen.go +++ b/internal/gen.go @@ -7,14 +7,13 @@ import ( "errors" "fmt" "go/format" - "log" "strings" "text/template" - "buf.build/gen/go/sqlc/sqlc/protocolbuffers/go/protos/plugin" "github.com/sqlc-dev/sqlc-gen-go/internal/opts" - "github.com/sqlc-dev/sqlc-go/metadata" "github.com/sqlc-dev/sqlc-go/sdk" + "github.com/sqlc-dev/sqlc-go/metadata" + "github.com/sqlc-dev/sqlc-go/plugin" ) type tmplCtx struct { @@ -104,7 +103,7 @@ func (t *tmplCtx) codegenQueryRetval(q Query) (string, error) { } } -func Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) { +func Generate(ctx context.Context, req *plugin.GenerateRequest) (*plugin.GenerateResponse, error) { options, err := opts.Parse(req) if err != nil { return nil, err @@ -125,12 +124,10 @@ func Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plugin.CodeGenR enums, structs = filterUnusedStructs(enums, structs, queries) } - log.Println("HELLO") - return generate(req, options, enums, structs, queries) } -func generate(req *plugin.CodeGenRequest, options *opts.Options, enums []Enum, structs []Struct, queries []Query) (*plugin.CodeGenResponse, error) { +func generate(req *plugin.GenerateRequest, options *opts.Options, enums []Enum, structs []Struct, queries []Query) (*plugin.GenerateResponse, error) { i := &importer{ Options: options, Queries: queries, @@ -285,7 +282,7 @@ func generate(req *plugin.CodeGenRequest, options *opts.Options, enums []Enum, s return nil, err } } - resp := plugin.CodeGenResponse{} + resp := plugin.GenerateResponse{} for filename, code := range output { resp.Files = append(resp.Files, &plugin.File{ diff --git a/internal/go_type.go b/internal/go_type.go index 8feaa38..ca6622d 100644 --- a/internal/go_type.go +++ b/internal/go_type.go @@ -5,12 +5,12 @@ import ( "github.com/sqlc-dev/sqlc-gen-go/internal/opts" "github.com/sqlc-dev/sqlc-go/sdk" - "buf.build/gen/go/sqlc/sqlc/protocolbuffers/go/protos/plugin" + "github.com/sqlc-dev/sqlc-go/plugin" ) -func addExtraGoStructTags(tags map[string]string, req *plugin.CodeGenRequest, options *opts.Options, col *plugin.Column) { +func addExtraGoStructTags(tags map[string]string, req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) { for _, override := range options.Overrides { - oride := override.Plugin + oride := override.ShimOverride if oride.GoType.StructTags == nil { continue } @@ -33,10 +33,10 @@ func addExtraGoStructTags(tags map[string]string, req *plugin.CodeGenRequest, op } } -func goType(req *plugin.CodeGenRequest, options *opts.Options, col *plugin.Column) string { +func goType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) string { // Check if the column's type has been overridden for _, override := range options.Overrides { - oride := override.Plugin + oride := override.ShimOverride if oride.GoType.TypeName == "" { continue @@ -63,13 +63,13 @@ func goType(req *plugin.CodeGenRequest, options *opts.Options, col *plugin.Colum return typ } -func goInnerType(req *plugin.CodeGenRequest, options *opts.Options, col *plugin.Column) string { +func goInnerType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) string { columnType := sdk.DataType(col.Type) notNull := col.NotNull || col.IsArray // package overrides have a higher precedence for _, override := range options.Overrides { - oride := override.Plugin + oride := override.ShimOverride if oride.GoType.TypeName == "" { continue } diff --git a/internal/imports.go b/internal/imports.go index 1c1755d..f7cd90b 100644 --- a/internal/imports.go +++ b/internal/imports.go @@ -200,7 +200,7 @@ func buildImports(options *opts.Options, queries []Query, uses func(string) bool overrideTypes := map[string]string{} for _, override := range options.Overrides { - o := override.Plugin + o := override.ShimOverride if o.GoType.BasicType || o.GoType.TypeName == "" { continue } @@ -226,7 +226,7 @@ func buildImports(options *opts.Options, queries []Query, uses func(string) bool // Custom imports for _, override := range options.Overrides { - o := override.Plugin + o := override.ShimOverride if o.GoType.BasicType || o.GoType.TypeName == "" { continue diff --git a/internal/mysql_type.go b/internal/mysql_type.go index 4810f4b..faa31dd 100644 --- a/internal/mysql_type.go +++ b/internal/mysql_type.go @@ -6,10 +6,10 @@ import ( "github.com/sqlc-dev/sqlc-gen-go/internal/opts" "github.com/sqlc-dev/sqlc-go/sdk" "github.com/sqlc-dev/sqlc-gen-go/internal/debug" - "buf.build/gen/go/sqlc/sqlc/protocolbuffers/go/protos/plugin" + "github.com/sqlc-dev/sqlc-go/plugin" ) -func mysqlType(req *plugin.CodeGenRequest, options *opts.Options, col *plugin.Column) string { +func mysqlType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) string { columnType := sdk.DataType(col.Type) notNull := col.NotNull || col.IsArray unsigned := col.Unsigned diff --git a/internal/opts/options.go b/internal/opts/options.go index ebb65f0..b5b97e3 100644 --- a/internal/opts/options.go +++ b/internal/opts/options.go @@ -1,12 +1,11 @@ package opts import ( - "bytes" "encoding/json" "fmt" "maps" - "buf.build/gen/go/sqlc/sqlc/protocolbuffers/go/protos/plugin" + "github.com/sqlc-dev/sqlc-go/plugin" ) type Options struct { @@ -48,7 +47,7 @@ type GlobalOptions struct { Rename map[string]string `json:"rename,omitempty" yaml:"rename"` } -func Parse(req *plugin.CodeGenRequest) (*Options, error) { +func Parse(req *plugin.GenerateRequest) (*Options, error) { options, err := parseOpts(req) if err != nil { return nil, err @@ -69,14 +68,13 @@ func Parse(req *plugin.CodeGenRequest) (*Options, error) { return options, nil } -func parseOpts(req *plugin.CodeGenRequest) (*Options, error) { +func parseOpts(req *plugin.GenerateRequest) (*Options, error) { var options Options if len(req.PluginOptions) == 0 { return &options, nil } - dec := json.NewDecoder(bytes.NewReader(req.PluginOptions)) - if err := dec.Decode(&options); err != nil { - return &options, fmt.Errorf("unmarshalling options: %w", err) + if err := json.Unmarshal(req.PluginOptions, &options); err != nil { + return nil, fmt.Errorf("unmarshalling plugin options: %w", err) } for i := range options.Overrides { @@ -93,21 +91,19 @@ func parseOpts(req *plugin.CodeGenRequest) (*Options, error) { return &options, nil } -func parseGlobalOpts(req *plugin.CodeGenRequest) (*GlobalOptions, error) { +func parseGlobalOpts(req *plugin.GenerateRequest) (*GlobalOptions, error) { var options GlobalOptions - return &options, nil - // if len(req.GlobalOptions) == 0 { - // return &options, nil - // } - // dec := json.NewDecoder(bytes.NewReader(req.GlobalOptions)) - // if err := dec.Decode(&options); err != nil { - // return &options, fmt.Errorf("unmarshalling options: %w", err) - // } - // for i := range options.Overrides { - // if err := options.Overrides[i].parse(req); err != nil { - // return nil, err - // } - // } + if len(req.GlobalOptions) == 0 { + return &options, nil + } + if err := json.Unmarshal(req.GlobalOptions, &options); err != nil { + return nil, fmt.Errorf("unmarshalling global options: %w", err) + } + for i := range options.Overrides { + if err := options.Overrides[i].parse(req); err != nil { + return nil, err + } + } return &options, nil } diff --git a/internal/opts/override.go b/internal/opts/override.go index 6c42860..139342b 100644 --- a/internal/opts/override.go +++ b/internal/opts/override.go @@ -6,74 +6,9 @@ import ( "strings" "github.com/sqlc-dev/sqlc-go/pattern" - "buf.build/gen/go/sqlc/sqlc/protocolbuffers/go/protos/plugin" + "github.com/sqlc-dev/sqlc-go/plugin" ) -type PluginGoType struct { - ImportPath string - Package string - TypeName string - BasicType bool - StructTags map[string]string -} - -func pluginGoType(o *Override) *PluginGoType { - // Note that there is a slight mismatch between this and the - // proto api. The GoType on the override is the unparsed type, - // which could be a qualified path or an object, as per - // https://docs.sqlc.dev/en/v1.18.0/reference/config.html#type-overriding - return &PluginGoType{ - ImportPath: o.GoImportPath, - Package: o.GoPackage, - TypeName: o.GoTypeName, - BasicType: o.GoBasicType, - StructTags: o.GoStructTags, - } -} - -type PluginOverride struct { - DbType string - Nullable bool - Column string - Table *plugin.Identifier - ColumnName string - Unsigned bool - GoType *PluginGoType -} - -func pluginOverride(req *plugin.CodeGenRequest, o *Override) *PluginOverride { - var column string - var table plugin.Identifier - - if o.Column != "" { - colParts := strings.Split(o.Column, ".") - switch len(colParts) { - case 2: - table.Schema = req.Catalog.DefaultSchema - table.Name = colParts[0] - column = colParts[1] - case 3: - table.Schema = colParts[0] - table.Name = colParts[1] - column = colParts[2] - case 4: - table.Catalog = colParts[0] - table.Schema = colParts[1] - table.Name = colParts[2] - column = colParts[3] - } - } - return &PluginOverride{ - DbType: o.DBType, - Nullable: o.Nullable, - Unsigned: o.Unsigned, - Column: o.Column, - ColumnName: column, - Table: &table, - GoType: pluginGoType(o), - } -} - type Override struct { // name of the golang type to use, e.g. `github.com/segmentio/ksuid.KSUID` GoType GoType `json:"go_type" yaml:"go_type"` @@ -112,7 +47,7 @@ type Override struct { // Parsed form of GoStructTag, e.g. {"validate:", "required"} GoStructTags map[string]string `json:"-"` - Plugin *PluginOverride `json:"-"` + ShimOverride *ShimOverride `json:"-"` } func (o *Override) Matches(n *plugin.Identifier, defaultSchema string) bool { @@ -141,7 +76,7 @@ func (o *Override) Matches(n *plugin.Identifier, defaultSchema string) bool { return true } -func (o *Override) parse(req *plugin.CodeGenRequest) (err error) { +func (o *Override) parse(req *plugin.GenerateRequest) (err error) { // validate deprecated postgres_type field if o.Deprecated_PostgresType != "" { fmt.Fprintf(os.Stderr, "WARNING: \"postgres_type\" is deprecated. Instead, use \"db_type\" to specify a type override.\n") @@ -229,6 +164,6 @@ func (o *Override) parse(req *plugin.CodeGenRequest) (err error) { } o.GoStructTags = tags - o.Plugin = pluginOverride(req, o) + o.ShimOverride = shimOverride(req, o) return nil } diff --git a/internal/opts/shim.go b/internal/opts/shim.go new file mode 100644 index 0000000..d2a59ee --- /dev/null +++ b/internal/opts/shim.go @@ -0,0 +1,77 @@ +package opts + +import ( + "strings" + + "github.com/sqlc-dev/sqlc-go/plugin" +) + +// The ShimOverride struct exists to bridge the gap between the Override struct +// and the previous Override struct defined in codegen.proto. Eventually these +// shim structs should be removed in favor of using the existing Override and +// GoType structs, but it's easier to provide these shim structs to not change +// the existing, working code. +type ShimOverride struct { + DbType string + Nullable bool + Column string + Table *plugin.Identifier + ColumnName string + Unsigned bool + GoType *ShimGoType +} + +func shimOverride(req *plugin.GenerateRequest, o *Override) *ShimOverride { + var column string + var table plugin.Identifier + + if o.Column != "" { + colParts := strings.Split(o.Column, ".") + switch len(colParts) { + case 2: + table.Schema = req.Catalog.DefaultSchema + table.Name = colParts[0] + column = colParts[1] + case 3: + table.Schema = colParts[0] + table.Name = colParts[1] + column = colParts[2] + case 4: + table.Catalog = colParts[0] + table.Schema = colParts[1] + table.Name = colParts[2] + column = colParts[3] + } + } + return &ShimOverride{ + DbType: o.DBType, + Nullable: o.Nullable, + Unsigned: o.Unsigned, + Column: o.Column, + ColumnName: column, + Table: &table, + GoType: shimGoType(o), + } +} + +type ShimGoType struct { + ImportPath string + Package string + TypeName string + BasicType bool + StructTags map[string]string +} + +func shimGoType(o *Override) *ShimGoType { + // Note that there is a slight mismatch between this and the + // proto api. The GoType on the override is the unparsed type, + // which could be a qualified path or an object, as per + // https://docs.sqlc.dev/en/v1.18.0/reference/config.html#type-overriding + return &ShimGoType{ + ImportPath: o.GoImportPath, + Package: o.GoPackage, + TypeName: o.GoTypeName, + BasicType: o.GoBasicType, + StructTags: o.GoStructTags, + } +} diff --git a/internal/postgresql_type.go b/internal/postgresql_type.go index 86f0786..d4abe03 100644 --- a/internal/postgresql_type.go +++ b/internal/postgresql_type.go @@ -8,7 +8,7 @@ import ( "github.com/sqlc-dev/sqlc-gen-go/internal/opts" "github.com/sqlc-dev/sqlc-go/sdk" "github.com/sqlc-dev/sqlc-gen-go/internal/debug" - "buf.build/gen/go/sqlc/sqlc/protocolbuffers/go/protos/plugin" + "github.com/sqlc-dev/sqlc-go/plugin" ) func parseIdentifierString(name string) (*plugin.Identifier, error) { @@ -34,7 +34,7 @@ func parseIdentifierString(name string) (*plugin.Identifier, error) { } } -func postgresType(req *plugin.CodeGenRequest, options *opts.Options, col *plugin.Column) string { +func postgresType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) string { columnType := sdk.DataType(col.Type) notNull := col.NotNull || col.IsArray driver := parseDriver(options.SqlPackage) diff --git a/internal/query.go b/internal/query.go index b70687b..b88f79f 100644 --- a/internal/query.go +++ b/internal/query.go @@ -5,7 +5,7 @@ import ( "strings" "github.com/sqlc-dev/sqlc-go/metadata" - "buf.build/gen/go/sqlc/sqlc/protocolbuffers/go/protos/plugin" + "github.com/sqlc-dev/sqlc-go/plugin" ) type QueryValue struct { diff --git a/internal/result.go b/internal/result.go index 5157918..338646b 100644 --- a/internal/result.go +++ b/internal/result.go @@ -9,10 +9,10 @@ import ( "github.com/sqlc-dev/sqlc-go/sdk" "github.com/sqlc-dev/sqlc-gen-go/internal/inflection" "github.com/sqlc-dev/sqlc-go/metadata" - "buf.build/gen/go/sqlc/sqlc/protocolbuffers/go/protos/plugin" + "github.com/sqlc-dev/sqlc-go/plugin" ) -func buildEnums(req *plugin.CodeGenRequest, options *opts.Options) []Enum { +func buildEnums(req *plugin.GenerateRequest, options *opts.Options) []Enum { var enums []Enum for _, schema := range req.Catalog.Schemas { if schema.Name == "pg_catalog" || schema.Name == "information_schema" { @@ -59,7 +59,7 @@ func buildEnums(req *plugin.CodeGenRequest, options *opts.Options) []Enum { return enums } -func buildStructs(req *plugin.CodeGenRequest, options *opts.Options) []Struct { +func buildStructs(req *plugin.GenerateRequest, options *opts.Options) []Struct { var structs []Struct for _, schema := range req.Catalog.Schemas { if schema.Name == "pg_catalog" || schema.Name == "information_schema" { @@ -182,7 +182,7 @@ func argName(name string) string { return out } -func buildQueries(req *plugin.CodeGenRequest, options *opts.Options, structs []Struct) ([]Query, error) { +func buildQueries(req *plugin.GenerateRequest, options *opts.Options, structs []Struct) ([]Query, error) { qs := make([]Query, 0, len(req.Queries)) for _, query := range req.Queries { if query.Name == "" { @@ -332,7 +332,7 @@ func putOutColumns(query *plugin.Query) bool { // JSON tags: count, count_2, count_2 // // This is unlikely to happen, so don't fix it yet -func columnsToStruct(req *plugin.CodeGenRequest, options *opts.Options, name string, columns []goColumn, useID bool) (*Struct, error) { +func columnsToStruct(req *plugin.GenerateRequest, options *opts.Options, name string, columns []goColumn, useID bool) (*Struct, error) { gs := Struct{ Name: name, } diff --git a/internal/result_test.go b/internal/result_test.go index 1a0570a..1cbcb04 100644 --- a/internal/result_test.go +++ b/internal/result_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/sqlc-dev/sqlc-go/metadata" - "buf.build/gen/go/sqlc/sqlc/protocolbuffers/go/protos/plugin" + "github.com/sqlc-dev/sqlc-go/plugin" ) func TestPutOutColumns_ForZeroColumns(t *testing.T) { diff --git a/internal/sqlite_type.go b/internal/sqlite_type.go index 58ed5f2..f79d3f0 100644 --- a/internal/sqlite_type.go +++ b/internal/sqlite_type.go @@ -6,10 +6,10 @@ import ( "github.com/sqlc-dev/sqlc-go/sdk" "github.com/sqlc-dev/sqlc-gen-go/internal/debug" - "buf.build/gen/go/sqlc/sqlc/protocolbuffers/go/protos/plugin" + "github.com/sqlc-dev/sqlc-go/plugin" ) -func sqliteType(req *plugin.CodeGenRequest, col *plugin.Column) string { +func sqliteType(req *plugin.GenerateRequest, col *plugin.Column) string { dt := strings.ToLower(sdk.DataType(col.Type)) notNull := col.NotNull || col.IsArray diff --git a/internal/struct.go b/internal/struct.go index 3243620..db514e1 100644 --- a/internal/struct.go +++ b/internal/struct.go @@ -6,7 +6,7 @@ import ( "unicode/utf8" "github.com/sqlc-dev/sqlc-gen-go/internal/opts" - "buf.build/gen/go/sqlc/sqlc/protocolbuffers/go/protos/plugin" + "github.com/sqlc-dev/sqlc-go/plugin" ) type Struct struct {