Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
miladrahimi committed Feb 19, 2022
1 parent fb9bf33 commit b93f18b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ The following snippet expresses singleton binding.
err := container.Singleton(func() Abstraction {
return Implementation
})

// If you might return an error...

err := container.Singleton(func() (Abstraction, error) {
return Implementation, nil
})
```

It takes a resolver (function) whose return type is the abstraction and the function body returns the concrete (implementation).
Expand Down

0 comments on commit b93f18b

Please sign in to comment.