Skip to content

Refactor Kotlin codegen package to use plugin types #1416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ psql:
mysqlsh:
mysqlsh --sql --user root --password mysecretpassword --database dinotest 127.0.0.1:3306

fmt:
go fmt ./...

# $ protoc --version
# libprotoc 3.17.3
# go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func Generate(ctx context.Context, e Env, dir, filename string, stderr io.Writer
files, err = golang.Generate(result, combo)
case sql.Gen.Kotlin != nil:
out = combo.Kotlin.Out
files, err = kotlin.Generate(result, combo)
resp, err = kotlin.Generate(codeGenRequest(result, combo))
case sql.Gen.Python != nil:
out = combo.Python.Out
resp, err = python.Generate(codeGenRequest(result, combo))
Expand Down
9 changes: 9 additions & 0 deletions internal/cmd/shim.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ func pluginSettings(cs config.CombinedSettings) *plugin.Settings {
Overrides: over,
Rename: cs.Rename,
Python: pluginPythonCode(cs.Python),
Kotlin: pluginKotlinCode(cs.Kotlin),
}
}

Expand All @@ -75,6 +76,14 @@ func pluginPythonType(pt config.PythonType) *plugin.PythonType {
}
}

func pluginKotlinCode(s config.SQLKotlin) *plugin.KotlinCode {
return &plugin.KotlinCode{
Out: s.Out,
Package: s.Package,
EmitExactTableNames: s.EmitExactTableNames,
}
}

func pluginCatalog(c *catalog.Catalog) *plugin.Catalog {
var schemas []*plugin.Schema
for _, s := range c.Schemas {
Expand Down
Loading