feat: add SQLite ORM backend via ncruces/go-sqlite3#278
Draft
feat: add SQLite ORM backend via ncruces/go-sqlite3#278
Conversation
Implement a lightweight SQLite-based ORM storage backend as an
alternative to the existing Elasticsearch backend. The new module
follows the same orm.ORM interface pattern and is registered via
orm.Register("sqlite", handler).
Key features:
- JSON document storage with SQLite json_extract for queries
- Full ORM interface: CRUD, Search, SearchV2, DeleteByQuery
- QueryBuilder to SQL WHERE clause translation
- WAL mode for concurrent read performance
- Comprehensive test coverage (17 tests)
Agent-Logs-Url: https://github.com/infinilabs/framework/sessions/c7adba2d-c701-4bd0-9c10-ec59d79b4ae0
Co-authored-by: medcl <64487+medcl@users.noreply.github.com>
- Remove redundant variable assignment in RegisterSchemaWithName - Fix Search and SearchWithResultItemMapper to return correct total count via separate COUNT query instead of counting fetched rows Agent-Logs-Url: https://github.com/infinilabs/framework/sessions/c7adba2d-c701-4bd0-9c10-ec59d79b4ae0 Co-authored-by: medcl <64487+medcl@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
medcl
April 18, 2026 07:17
View session
This file is in .gitignore and should not be tracked. It is generated by the build process. Co-authored-by: medcl <64487+medcl@users.noreply.github.com>
Agent-Logs-Url: https://github.com/infinilabs/framework/sessions/f6db8347-448d-4d9b-a129-f1a526faf6e8 Co-authored-by: medcl <64487+medcl@users.noreply.github.com>
…tterns Add 12 new tests covering the complex nested query patterns used by the security search operation hook (RegisterSearchOperationHook): - Must wrapping ShouldQuery with minimum_should_match - Owner-only queries (no sharing) - Should with shared resource IDs - Category filter with owner - Nested BooleanQuery inside Should (folder access + deny rules) - Should with MustNot folder deny rules - Dotted field paths (_system.owner_id, _system.parent_path) - Filter with MustQuery wrapper - Full search hook simulation with all patterns combined - Multiple folder allow/deny paths - Category children sharing - Empty ShouldQuery edge case Agent-Logs-Url: https://github.com/infinilabs/framework/sessions/8d394cd4-0c76-4a0e-9db1-f463b0a2006f Co-authored-by: medcl <64487+medcl@users.noreply.github.com>
Agent-Logs-Url: https://github.com/infinilabs/framework/sessions/8d394cd4-0c76-4a0e-9db1-f463b0a2006f Co-authored-by: medcl <64487+medcl@users.noreply.github.com>
…e ORM Add 7 new integration tests verifying the SQLite backend correctly handles the patterns used by RegisterDataOperationPreHook for Create, Update, and Save operations: - System field round-trip (Create with _system.owner_id, Get, verify) - Update preserving system fields after deserialization - Save (upsert) with SystemFieldAccessor interface - GetOwnerID and Object/SystemFieldAccessor interface after SQLite deserialization - SearchV2 filtering by _system.owner_id via json_extract - SearchV2 with ShouldQuery combining owner OR shared IDs - DeleteByQuery filtering by _system.owner_id Also add missing constants to config/generated.go for build compatibility. Agent-Logs-Url: https://github.com/infinilabs/framework/sessions/39670c0d-37f0-4903-969b-1c006bf7cdab Co-authored-by: medcl <64487+medcl@users.noreply.github.com>
Agent-Logs-Url: https://github.com/infinilabs/framework/sessions/39670c0d-37f0-4903-969b-1c006bf7cdab Co-authored-by: medcl <64487+medcl@users.noreply.github.com>
Update clauseToSQL to properly read and respect the minimum_should_match parameter from clause.Parameters: - When minimum_should_match >= 1: should clauses are required (OR join) - When only 1 should clause with min_should_match=1: treat as mandatory (no unnecessary OR wrapping) - When minimum_should_match is unset and no must/filter exist: default to requiring at least 1 match (Elasticsearch semantics) - When minimum_should_match is unset with must/filter present: should clauses are optional (scoring-only in ES, safely skipped in SQLite) Add unit tests: - SingleShouldMinShouldMatch1_IsMandatory - SingleShouldWithFilterAndMinShouldMatch1 - OptionalShouldWithoutMinShouldMatch Add integration test: - SearchV2_SingleShouldOwnerIsMandatory (end-to-end with real SQLite DB) Agent-Logs-Url: https://github.com/infinilabs/framework/sessions/dc353da8-ad60-4779-86ff-b7a7e5d614d2 Co-authored-by: medcl <64487+medcl@users.noreply.github.com>
Agent-Logs-Url: https://github.com/infinilabs/framework/sessions/dc353da8-ad60-4779-86ff-b7a7e5d614d2 Co-authored-by: medcl <64487+medcl@users.noreply.github.com>
This file is gitignored and regenerated at build time by the Makefile. The LastFrameworkCommitLog and LastFrameworkVendorCommitLog constants are generated separately into config/generated_framework-info.go. Agent-Logs-Url: https://github.com/infinilabs/framework/sessions/3922a466-05d7-40bf-8429-fc6e3821230d Co-authored-by: medcl <64487+medcl@users.noreply.github.com>
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.
config/generated.goto use fixed placeholder values (N/A, 0.0.1-SNAPSHOT) matchingmake restore-generated-fileoutputLastFrameworkCommitLog/LastFrameworkVendorCommitLogremain in separategenerated_framework-info.go(generated by Makefile, gitignored)