Skip to content
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
matthewmcneely/add-upsert-support
Jul 1, 2025
Merged

feat: Add upsert and unique checking in local mode#104
matthewmcneely merged 18 commits intomainfrom
matthewmcneely/add-upsert-support

Conversation

@matthewmcneely
Copy link
Contributor

Description

This PR adds upsert and unique checking to modusGraph in "local" mode.

Checklist

  • Code compiles correctly and linting passes locally
  • For all code changes, an entry added to the CHANGELOG.md file describing and linking to
    this PR
  • Tests added for new functionality, or regression tests for bug fixes added as applicable

@matthewmcneely matthewmcneely marked this pull request as ready for review June 17, 2025 00:36
@matthewmcneely matthewmcneely requested review from a team and Copilot June 17, 2025 00:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@matthewmcneely matthewmcneely enabled auto-merge (squash) June 17, 2025 00:37
@matthewmcneely matthewmcneely changed the title feat: Add upsert and unique checking in local mode [DRAFT] feat: Add upsert and unique checking in local mode Jun 19, 2025
@matthewmcneely matthewmcneely merged commit b222f13 into main Jul 1, 2025
8 checks passed
@matthewmcneely matthewmcneely deleted the matthewmcneely/add-upsert-support branch July 1, 2025 15:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants