Skip to content
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

feat: provide Kotlin API for db connections #753

Closed
wants to merge 1 commit into from

Conversation

worstell
Copy link
Contributor

@worstell worstell commented Jan 9, 2024

schema parsing to follow

Copy link
Collaborator

@alecthomas alecthomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM, but please change the config file to use an envar with a cross-language-compatible DSN format, and translate that into whatever Java supports in the runtime.

integration/integration_test.go Outdated Show resolved Hide resolved
integration/integration_test.go Show resolved Hide resolved
@worstell worstell force-pushed the worstell/20240108-dbconn branch 3 times, most recently from 2d7176a to 349d6b4 Compare January 10, 2024 22:21
@worstell worstell requested a review from alecthomas January 10, 2024 22:22
@worstell worstell force-pushed the worstell/20240108-dbconn branch 8 times, most recently from 61db968 to 35d2773 Compare January 12, 2024 05:07
@worstell worstell force-pushed the worstell/20240108-dbconn branch from 3f65e47 to 400e2db Compare January 12, 2024 05:10
assert.NoError(t, err)

var exists bool
query := `SELECT EXISTS(SELECT datname FROM pg_catalog.pg_database WHERE datname = $1);`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

val host = uri.host ?: throw IllegalArgumentException("Missing host in DSN.")
val port = if (uri.port != -1) uri.port.toString() else throw IllegalArgumentException("Missing port in DSN.")
val database = uri.path.trimStart('/')
val parameters = uri.query?.replace("&", "?") ?: ""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes me sad.

"connectrpc.com/connect"
"github.com/alecthomas/assert/v2"
_ "github.com/amacneil/dbmate/v2/pkg/driver/postgres"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this for?

@alecthomas
Copy link
Collaborator

Oh is this redundant now?

@alecthomas alecthomas mentioned this pull request Jan 12, 2024
4 tasks
@worstell
Copy link
Contributor Author

Oh is this redundant now?

yeah, had intended for these to be split into two PRs (this with the API implementation and the other with schema parsing), but i think since the latter was based on this branch and both commits showed up on github (probably needed to rebase to fix this) it was confusing. going to assume the stamp on the other PR includes these changes and close this 😄

@worstell worstell closed this Jan 12, 2024
@alecthomas alecthomas deleted the worstell/20240108-dbconn branch February 9, 2024 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants