Skip to content

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
@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
@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.

3 participants