Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add ReplaceNamed(), InsertBeforeNamed(), and InsertAfterNamed() #63

Merged
merged 5 commits into from
Apr 1, 2023

Conversation

muir
Copy link
Owner

@muir muir commented Apr 1, 2023

New functions that allow manipulating the injection chain using the names assigned with Provide()

@muir muir requested a review from sharnoff April 1, 2023 22:22
@codecov
Copy link

codecov bot commented Apr 1, 2023

Codecov Report

Patch coverage: 93.82% and project coverage change: +0.50 🎉

Comparison is base (22f5e15) 83.89% compared to head (d7e14ae) 84.40%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #63      +/-   ##
==========================================
+ Coverage   83.89%   84.40%   +0.50%     
==========================================
  Files          21       22       +1     
  Lines        3024     3186     +162     
==========================================
+ Hits         2537     2689     +152     
- Misses        317      323       +6     
- Partials      170      174       +4     
Impacted Files Coverage Δ
api.go 93.97% <ø> (ø)
replace.go 93.58% <93.58%> (ø)
nject.go 84.76% <100.00%> (+0.44%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.


// This demonstrates how it to have a default that gets overridden by
// by later inputs using Reorder
func ExampleReorder() {
Copy link
Owner Author

Choose a reason for hiding this comment

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

Moved as-is

@muir muir changed the base branch from main to race April 1, 2023 23:08
@muir muir changed the title Add ReplaceNamed(), InsertBeforeNamed(), and InsertAfterNamed() feat: Add ReplaceNamed(), InsertBeforeNamed(), and InsertAfterNamed() Apr 1, 2023
Base automatically changed from race to main April 1, 2023 23:13
replace.go Outdated
// be tagging a colleciton, not an individual.
func (c *Collection) handleReplaceByName() (err error) {
defer func() {
// if err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this meant to be commented out?

replace.go Outdated
if err != nil {
return err
}
firstMove, lastMove := snip(n, func(n *node) bool { return n.fm.insertBeforeName == name })
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
firstMove, lastMove := snip(n, func(n *node) bool { return n.fm.insertBeforeName == name })
firstMove, lastMove := snip(n, func(n *node) bool { return n.fm.insertAfterName == name })

replace.go Outdated
// step 4, convert back to list
contents := make([]*provider, 0, len(c.contents))
for n := head.next; n != tail; n = n.next {
if n.fm != nil && n.fm.fn != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

can this condition be false?

@muir muir merged commit b7fb35f into main Apr 1, 2023
@muir muir deleted the manipulate branch April 1, 2023 23:43
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.

2 participants