-
Notifications
You must be signed in to change notification settings - Fork 6
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 :-)
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.