Skip to content

Commit a3f06d1

Browse files
committed
Fix: Fix types and test formatting
1 parent 0c27bd4 commit a3f06d1

4 files changed

Lines changed: 26 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ jobs:
5555
- name: Run Rust tests
5656
run: cargo test --manifest-path native/ecto_libsql/Cargo.toml --all-features
5757

58+
- name: Install cargo-deny if not present
59+
run: |
60+
if ! command -v cargo-deny &> /dev/null; then
61+
echo "cargo-deny not found, installing..."
62+
cargo install cargo-deny --locked
63+
else
64+
echo "cargo-deny already installed: $(cargo-deny --version)"
65+
fi
66+
5867
- name: Check licences and security advisories
5968
working-directory: native/ecto_libsql
6069
run: cargo deny check licenses advisories

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
131131

132132
- **License and Security Advisory Checking**
133133
- Added `cargo-deny` configuration (`deny.toml`) for dependency auditing
134-
- Checks for: license compliance, security advisories, duplicate dependencies
134+
- Checks for license compliance, security advisories, duplicate dependencies
135135
- Integrated into CI pipeline
136136

137137
- **SQLite Hook Investigation (Documented as Unsupported)**

lib/ecto_libsql/native.ex

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ defmodule EctoLibSql.Native do
443443
{:ok, _} = EctoLibSql.Native.commit(state)
444444
445445
"""
446-
@spec commit(EctoLibSql.State.t()) :: {:ok, EctoLibSql.State.t()} | {:error, term()}
446+
@spec commit(EctoLibSql.State.t()) :: {:ok, String.t()} | {:error, term()}
447447
def commit(
448448
%EctoLibSql.State{conn_id: conn_id, trx_id: trx_id, mode: mode, sync: syncx} = _state
449449
) do
@@ -460,7 +460,7 @@ defmodule EctoLibSql.Native do
460460
{:ok, _} = EctoLibSql.Native.rollback(state)
461461
462462
"""
463-
@spec rollback(EctoLibSql.State.t()) :: {:ok, EctoLibSql.State.t()} | {:error, term()}
463+
@spec rollback(EctoLibSql.State.t()) :: {:ok, String.t()} | {:error, term()}
464464
def rollback(
465465
%EctoLibSql.State{conn_id: conn_id, trx_id: trx_id, mode: mode, sync: syncx} = _state
466466
) do
@@ -503,17 +503,28 @@ defmodule EctoLibSql.Native do
503503
String.downcase(first_word)
504504
end
505505

506+
# DML commands - data manipulation.
506507
defp command_atom("select"), do: :select
507508
defp command_atom("insert"), do: :insert
508509
defp command_atom("update"), do: :update
509510
defp command_atom("delete"), do: :delete
511+
512+
# Transaction control commands.
510513
defp command_atom("begin"), do: :begin
511514
defp command_atom("commit"), do: :commit
512-
defp command_atom("create"), do: :create
513515
defp command_atom("rollback"), do: :rollback
516+
517+
# DDL commands - schema modifications are grouped under :create since they
518+
# all modify database structure rather than data, and don't require distinct
519+
# handling in result processing.
520+
defp command_atom("create"), do: :create
514521
defp command_atom("drop"), do: :create
515522
defp command_atom("alter"), do: :create
523+
524+
# SQLite-specific.
516525
defp command_atom("pragma"), do: :pragma
526+
527+
# Catch-all for unrecognised commands.
517528
defp command_atom(_), do: :unknown
518529

519530
@doc """

test/ecto_libsql_test.exs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,8 @@ defmodule EctoLibSqlTest do
185185
select_execute =
186186
EctoLibSql.handle_execute(query_select, ["[email protected]"], [], remote_state)
187187

188-
assert {:ok, _query,
189-
%EctoLibSql.Result{command: :select, columns: [], rows: [], num_rows: 0},
190-
_state} =
191-
select_execute
188+
assert {:ok, _query, result, _state} = select_execute
189+
assert %EctoLibSql.Result{command: :select, columns: [], rows: [], num_rows: 0} = result
192190
end
193191
end
194192

0 commit comments

Comments
 (0)