This repository was archived by the owner on Sep 5, 2025. It is now read-only.
feat: Add upsert and unique checking in local mode#104
Merged
matthewmcneely merged 18 commits intomainfrom Jul 1, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds upsert functionality and unique field verification for local (file-based) mode, including improvements to client configuration and documentation support. Key changes include:
- New variadic Upsert method and local-mode support in client.go.
- Additional tests covering upsert, unique constraints, and embedded object handling.
- Documentation updates in README and added configuration options (e.g. maxEdgeTraversal).
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| upsert_test.go | Added tests for basic and predicate-based upsert operations. |
| update_test.go | Expanded update tests to cover unique constraints and batch update scenarios. |
| mutate.go | Introduced unique verification and recursive upsert support, with improved handling of slice and single object. |
| internal_test.go | Added structural tag tests to ensure proper processing of unique/upsert directives. |
| insert_test.go | Enhanced insertion tests with embedded objects and depth query adjustments. |
| client.go | Updated API design with optional upsert predicates, new client options (maxEdgeTraversal), and local-mode logic. |
| README.md | Revised documentation to reflect local-mode limitations and new upsert features. |
Comments suppressed due to low confidence (2)
client.go:258
- [nitpick] Consider renaming the internal upsert helper function (e.g. to 'localUpsert') to clearly distinguish it from the public Upsert method, reducing potential confusion during maintenance.
func (c client) Upsert(ctx context.Context, obj any, predicates ...string) error {
engine.go:82
- Please add a comment explaining the rationale for choosing the value 100000 for TypeFilterUidLimit to aid future maintainers.
worker.Config.TypeFilterUidLimit = 100000
1 task
ryanfoxtyler
approved these changes
Jul 1, 2025
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
This PR adds upsert and unique checking to modusGraph in "local" mode.
Checklist
CHANGELOG.mdfile describing and linking tothis PR