9
9
"strconv"
10
10
"strings"
11
11
12
- "buf.build/gen/go/ sqlc/sqlc/protocolbuffers/ go/protos/plugin "
13
- "github.com/sqlc-dev/sqlc- go/metadata "
14
- "github.com/sqlc-dev/sqlc -go/sdk"
12
+ "github.com/ sqlc-dev/plugin-sdk- go/metadata "
13
+ "github.com/sqlc-dev/plugin-sdk- go/plugin "
14
+ "github.com/sqlc-dev/plugin-sdk -go/sdk"
15
15
16
16
"github.com/sqlc-dev/sqlc-gen-kotlin/internal/inflection"
17
17
)
@@ -230,7 +230,7 @@ func ktEnumValueName(value string) string {
230
230
return strings .ToUpper (id )
231
231
}
232
232
233
- func BuildEnums (req * plugin.CodeGenRequest ) []Enum {
233
+ func BuildEnums (req * plugin.GenerateRequest ) []Enum {
234
234
var enums []Enum
235
235
for _ , schema := range req .Catalog .Schemas {
236
236
if schema .Name == "pg_catalog" || schema .Name == "information_schema" {
@@ -264,9 +264,6 @@ func BuildEnums(req *plugin.CodeGenRequest) []Enum {
264
264
}
265
265
266
266
func dataClassName (name string , settings * plugin.Settings ) string {
267
- if rename := settings .Rename [name ]; rename != "" {
268
- return rename
269
- }
270
267
out := ""
271
268
for _ , p := range strings .Split (name , "_" ) {
272
269
out += strings .Title (p )
@@ -278,7 +275,7 @@ func memberName(name string, settings *plugin.Settings) string {
278
275
return sdk .LowerTitle (dataClassName (name , settings ))
279
276
}
280
277
281
- func BuildDataClasses (conf Config , req * plugin.CodeGenRequest ) []Struct {
278
+ func BuildDataClasses (conf Config , req * plugin.GenerateRequest ) []Struct {
282
279
var structs []Struct
283
280
for _ , schema := range req .Catalog .Schemas {
284
281
if schema .Name == "pg_catalog" || schema .Name == "information_schema" {
@@ -367,7 +364,7 @@ func (t ktType) IsUUID() bool {
367
364
return t .Name == "UUID"
368
365
}
369
366
370
- func makeType (req * plugin.CodeGenRequest , col * plugin.Column ) ktType {
367
+ func makeType (req * plugin.GenerateRequest , col * plugin.Column ) ktType {
371
368
typ , isEnum := ktInnerType (req , col )
372
369
return ktType {
373
370
Name : typ ,
@@ -379,7 +376,7 @@ func makeType(req *plugin.CodeGenRequest, col *plugin.Column) ktType {
379
376
}
380
377
}
381
378
382
- func ktInnerType (req * plugin.CodeGenRequest , col * plugin.Column ) (string , bool ) {
379
+ func ktInnerType (req * plugin.GenerateRequest , col * plugin.Column ) (string , bool ) {
383
380
// TODO: Extend the engine interface to handle types
384
381
switch req .Settings .Engine {
385
382
case "mysql" :
@@ -396,7 +393,7 @@ type goColumn struct {
396
393
* plugin.Column
397
394
}
398
395
399
- func ktColumnsToStruct (req * plugin.CodeGenRequest , name string , columns []goColumn , namer func (* plugin.Column , int ) string ) * Struct {
396
+ func ktColumnsToStruct (req * plugin.GenerateRequest , name string , columns []goColumn , namer func (* plugin.Column , int ) string ) * Struct {
400
397
gs := Struct {
401
398
Name : name ,
402
399
}
@@ -480,7 +477,7 @@ func parseInts(s []string) ([]int, error) {
480
477
return refs , nil
481
478
}
482
479
483
- func BuildQueries (req * plugin.CodeGenRequest , structs []Struct ) ([]Query , error ) {
480
+ func BuildQueries (req * plugin.GenerateRequest , structs []Struct ) ([]Query , error ) {
484
481
qs := make ([]Query , 0 , len (req .Queries ))
485
482
for _ , query := range req .Queries {
486
483
if query .Name == "" {
0 commit comments