Skip to content
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
6 changes: 4 additions & 2 deletions .formatter.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Used by "mix format"
[
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"],
inputs: [
"{mix,.formatter}.exs",
"{config,lib,test}/**/*.{ex,exs}"
],
line_length: 88
]
52 changes: 38 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,47 @@
name: CI
on: [push, pull_request]
jobs:
test-elixir:
runs-on: ubuntu-latest
container: elixir:${{ matrix.elixir_version }}-slim

on:
pull_request:
push:
branches:
- main

jobs:
test:
runs-on: ubuntu-20.04
env:
MIX_ENV: test
strategy:
fail-fast: false
matrix:
elixir_version: ["1.8", "1.9", "1.10", "1.11"]

include:
- pair:
elixir: 1.8.2
otp: 20.3.8.26
- pair:
elixir: 1.11.4
otp: 23.2.7
lint: lint
steps:
- uses: actions/checkout@v2

- name: Install system dependencies
run: |
apt-get update
apt-get install --no-install-recommends -y git build-essential
mix local.rebar --force
mix local.hex --force
mix deps.get
- uses: erlef/setup-elixir@v1
with:
otp-version: ${{matrix.pair.otp}}
elixir-version: ${{matrix.pair.elixir}}

- name: Install Dependencies
run: mix deps.get --only test

- run: mix format --check-formatted
if: ${{ matrix.lint }}

- run: mix deps.get && mix deps.unlock --check-unused
if: ${{ matrix.lint }}

- run: mix deps.compile

- run: mix compile --warnings-as-errors
if: ${{ matrix.lint }}

- run: mix test
13 changes: 11 additions & 2 deletions lib/exqlite/connection.ex
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,11 @@ defmodule Exqlite.Connection do
def handle_commit(options, %{transaction_status: transaction_status} = state) do
case Keyword.get(options, :mode, :deferred) do
:savepoint when transaction_status == :transaction ->
handle_transaction(:commit_savepoint, "RELEASE SAVEPOINT exqlite_savepoint", state)
handle_transaction(
:commit_savepoint,
"RELEASE SAVEPOINT exqlite_savepoint",
state
)

mode
when mode in [:deferred, :immediate, :exclusive, :transaction] and
Expand All @@ -224,7 +228,11 @@ defmodule Exqlite.Connection do
"ROLLBACK TO SAVEPOINT exqlite_savepoint",
state
) do
handle_transaction(:rollback_savepoint, "RELEASE SAVEPOINT exqlite_savepoint", state)
handle_transaction(
:rollback_savepoint,
"RELEASE SAVEPOINT exqlite_savepoint",
state
)
end

mode
Expand Down Expand Up @@ -498,6 +506,7 @@ defmodule Exqlite.Connection do
columns: [],
num_rows: 0
}

{:ok, result, %{state | transaction_status: transaction_status}}
else
{:error, reason} ->
Expand Down
4 changes: 2 additions & 2 deletions lib/exqlite/result.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule Exqlite.Result do
command: atom,
columns: [String.t()] | nil,
rows: [[term] | term] | nil,
num_rows: integer(),
num_rows: integer()
}

defstruct command: nil, columns: [], rows: [], num_rows: 0
Expand All @@ -13,7 +13,7 @@ defmodule Exqlite.Result do
command: Keyword.get(options, :command),
columns: Keyword.get(options, :columns, []),
rows: Keyword.get(options, :rows, []),
num_rows: Keyword.get(options, :num_rows, 0),
num_rows: Keyword.get(options, :num_rows, 0)
}
end
end
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ defmodule Exqlite.MixProject do
[
{:db_connection, "~> 2.1"},
{:elixir_make, "~> 0.6", runtime: false},
{:ex_doc, "~> 0.24", only: [:dev], runtime: false},
{:ex_doc, "~> 0.24", only: [:docs], runtime: false},
{:temp, "~> 0.4", only: [:test]}
]
end
Expand Down