fix: correct separate options#74
Conversation
Summary by CodeRabbit
WalkthroughRenamed exported option fields Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
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 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 detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (1)
🔇 Additional comments (3)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
query.go (1)
48-50: Avoid Select([]) no-column edge caseGuard 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.
📒 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 semanticsThe boolean gate is correct: Separate=true → Preload, else → Joins. LGTM.
Also applies to: 94-98
| Separate bool | ||
| } |
There was a problem hiding this comment.
💡 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
Seperatestruct literals in query_test.go (lines 387 and 466) withSeparate. - 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.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
No description provided.