Skip to content

fix: correct separate options#74

Merged
ren0503 merged 2 commits into
masterfrom
fix/ren/73-correct-separate-name
Aug 30, 2025
Merged

fix: correct separate options#74
ren0503 merged 2 commits into
masterfrom
fix/ren/73-correct-separate-name

Conversation

@ren0503

@ren0503 ren0503 commented Aug 30, 2025

Copy link
Copy Markdown
Contributor

No description provided.

@coderabbitai

coderabbitai Bot commented Aug 30, 2025

Copy link
Copy Markdown

Summary by CodeRabbit

  • New Features
    • None.
  • Bug Fixes
    • Corrected a misspelled public option flag from “Seperate” to “Separate” in find options. Behavior is unchanged: enabling “Separate” uses preloading; otherwise joins are used.
    • If you reference this option, update your code to the new spelling to avoid compilation errors.
  • Chores
    • Updated internal tests to reflect the corrected option name.

Walkthrough

Renamed exported option fields SeperateSeparate in FindOneOptions and FindOptions (query.go) and updated all usages in FindAll/FindOne and tests; semantics unchanged (Separate==true → Preload, else Joins).

Changes

Cohort / File(s) Summary of Changes
Option rename & core usage updates
query.go
Renamed exported bool fields SeperateSeparate in FindOneOptions and FindOptions; updated checks in FindAll and FindOne to use opt.Separate to choose Preload vs Joins. No logic change.
Tests updated to match API
query_test.go
Replaced test usages of Seperate: true with Separate: true; local test variable renamed (e.g., empSeperateempSeparate). Aligns tests with updated exported fields.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

Hop! I nudge a letter into place,
Seperate becomes Separate with grace.
Preload hops in when true I say,
Joins hold steady when false's the way.
A rabbit's tweak — small, neat, and spry. 🥕

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.2.2)

Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/product/migration-guide for migration instructions
The command is terminated due to an error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/product/migration-guide for migration instructions

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between dad3e9d and e350f65.

📒 Files selected for processing (1)
  • query_test.go (2 hunks)
🔇 Additional comments (3)
query_test.go (3)

391-393: Local var rename matches API change.

empSeparate naming is consistent with Separate semantics. No issues.


464-468: FindOne preload path covered with Separate: true.

Good coverage for the Separate/Preload branch after the rename.


385-389: Approve code changes: Separate: true is used correctly and no lingering Seperate references remain.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/ren/73-correct-separate-name

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
query.go (1)

48-50: Avoid Select([]) no-column edge case

Guard on length instead of nil so an empty but non-nil slice doesn’t emit an empty SELECT set.

- if opt.Select != nil {
+ if len(opt.Select) > 0 {
   tx = tx.Select(opt.Select)
 }

Apply in FindAll (Lines 48-50), FindOne (Lines 101-103), and Exist (Lines 156-158).

Also applies to: 101-103, 156-158

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 4e373a8 and dad3e9d.

📒 Files selected for processing (1)
  • query.go (4 hunks)
🔇 Additional comments (1)
query.go (1)

38-42: Preload vs Joins switch reads clearly and preserves prior semantics

The boolean gate is correct: Separate=true → Preload, else → Joins. LGTM.

Also applies to: 94-98

Comment thread query.go
Comment on lines +14 to 15
Separate bool
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Typo fix in exported field is correct; note API break and clean up stragglers

Renaming Seperate→Separate is a breaking change for consumers constructing options via struct literals. Please update docs/CHANGELOG and sweep the repo for any remaining references.

Optionally add a short field doc to clarify semantics (true → Preload, false → Joins).

 type FindOneOptions struct {
   Select      []string
   Order       []string
   WithDeleted bool
   Related     []string
-  Separate    bool
+  // Separate: when true, load associations via Preload (separate queries); when false, use Joins.
+  Separate    bool
 }
 
 type FindOptions struct {
   Distinct    []interface{}
   Select      []string
   Order       []string
   WithDeleted bool
   Limit       int
   Offset      int
   Related     []string
-  Separate    bool
+  // Separate: when true, load associations via Preload (separate queries); when false, use Joins.
+  Separate    bool
 }

Also applies to: 25-26


🏁 Script executed:

#!/bin/bash
# Find any lingering misspellings
rg -n -S -g '!**/vendor/**' '\bSeperate\b|\bseperate\b'

Length of output: 129


Update lingering Seperate references in tests & docs

  • Replace all remaining Seperate struct literals in query_test.go (lines 387 and 466) with Separate.
  • Add a note in docs/CHANGELOG about this breaking change.
  • (nit) Add a field doc for Separate to clarify semantics, for example:
    // Separate: when true, load associations via Preload (separate queries); when false, use Joins.
    Separate bool
🤖 Prompt for AI Agents
In query.go around lines 14 to 15, the struct field was renamed to Separate but
tests/docs still reference the old misspelling `Seperate`; update all
occurrences in query_test.go (notably lines ~387 and ~466) to use `Separate`,
add a short field doc comment above the Separate declaration explaining its
semantics (e.g., when true use Preload/separate queries, when false use Joins),
and add a brief note to docs/CHANGELOG describing this breaking change so
consumers are aware of the renamed field.

@ren0503 ren0503 linked an issue Aug 30, 2025 that may be closed by this pull request
@ren0503 ren0503 added this to the SQL ORM Release v2.3.3 milestone Aug 30, 2025
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ren0503 ren0503 merged commit 3c93063 into master Aug 30, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Correct Separate instead of Seperate

2 participants