Align API with Ecto Repo conventions (breaking change)#2
Merged
tylerbarker merged 3 commits intomainfrom Dec 29, 2025
Merged
Conversation
This is a breaking change that simplifies the API to match Ecto.Repo.all/2
and Ecto.Repo.one/2 semantics.
Changes:
- query_all/4 now returns list directly (was {:ok, list}), raises on errors
- query_all!/4 removed (use query_all/4 instead)
- query_one/4 now returns result or nil (was {:ok, result | nil})
- query_one/4 now raises MultipleResultsError on multiple results
- File-based API (use SqlKit) follows the same changes
Also:
- Add sobelow_skip comments for false positive SQL injection warnings
- Update all documentation to reflect new API
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR aligns SqlKit's API with Ecto Repo conventions, making it more intuitive for Elixir developers familiar with Ecto. The changes target version 0.2.0 and introduce breaking changes to the API.
Key Changes:
query_all/4now returns results directly instead of{:ok, results}and raises on errors (matchingEcto.Repo.all/2)query_all!/4has been removed entirely (developers should usequery_all/4instead)query_one/4now returns result or nil directly and raises on multiple results or errors (matchingEcto.Repo.one/2)
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
lib/sql_kit/query.ex |
Refactored all/4 to raise instead of returning tuples; updated one/4 to return result/nil and raise on errors |
lib/sql_kit.ex |
Updated public API functions and documentation to match new semantics; file-based SQL API updated similarly |
lib/sql_kit/duckdb.ex |
Updated documentation examples to use new API |
lib/sql_kit/duckdb/pool.ex |
Updated documentation examples and added sobelow security annotations |
test/sql_kit_test.exs |
Comprehensive test updates: removed query_all!/3 tests, updated query_all/3 and query_one/3 tests to expect direct returns and raises |
test/sql_kit/duckdb_test.exs |
Updated DuckDB-specific tests to match new API behavior |
README.md |
Updated all usage examples, API reference, and migration guidance |
CLAUDE.md |
Updated AI assistant documentation with new API patterns |
CHANGELOG.md |
Added detailed breaking changes documentation with before/after examples |
mix.exs |
Version bumped from 0.1.0 to 0.2.0 |
.gitignore |
Added *.db and *.duckdb patterns for database files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Aligns SqlKit's API with Ecto Repo conventions for a more intuitive developer experience. This is a breaking change targeting version 0.2.0.
query_all/4now returns list directly and raises on errors (matchesEcto.Repo.all/2)query_all!/4removed entirely (no Ecto equivalent)query_one/4now returns result or nil, raises on multiple results (matchesEcto.Repo.one/2)use SqlKit) follows the same conventionsMigration Guide