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

Updated db_connection to v2 #32

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

andrewstuarttaxfix
Copy link

The codebase currently uses db_connection v1, which in itself uses Ecto 2. As a result of this, applications that rely on this library cannot upgrade to Ecto 3. This PR updates the codebase to use db_connection v2. The API to external clients stays the same as previously expected.

Copy link
Contributor

@liveforeverx liveforeverx left a comment

Choose a reason for hiding this comment

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

Looks good to me! Just some Nits comments/questions.

lib/grakn.ex Outdated
@@ -48,6 +48,13 @@ defmodule Grakn do
@spec query(conn(), Grakn.Query.t(), Keyword.t()) :: any()
def query(conn, query, opts \\ []) do
DBConnection.execute(get_conn(conn), query, [], with_transaction_config(opts))
|> case do
Copy link
Contributor

Choose a reason for hiding this comment

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

Really Nit:

What do you think about this style thing https://github.com/lexmag/elixir-style-guide#needless-pipeline ?

Copy link
Contributor

Choose a reason for hiding this comment

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

This is actually a case for with:

with {:ok, _query, result} <- 
      DBConnection.execute(get_conn(conn), query, [], with_transaction_config(opts)) do
  {:ok, result}
end

lib/grakn.ex Outdated
@@ -57,11 +64,30 @@ defmodule Grakn do
@spec query!(conn(), Grakn.Query.t(), Keyword.t()) :: any()
def query!(conn, %Grakn.Query{} = query, opts \\ []) do
DBConnection.execute!(get_conn(conn), query, [], with_transaction_config(opts))
|> case do
Copy link
Contributor

Choose a reason for hiding this comment

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

The same Nit question here :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants