Skip to content

Commit b93f18b

Browse files
authored
Update README.md
1 parent fb9bf33 commit b93f18b

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ The following snippet expresses singleton binding.
5151
err := container.Singleton(func() Abstraction {
5252
return Implementation
5353
})
54+
55+
// If you might return an error...
56+
57+
err := container.Singleton(func() (Abstraction, error) {
58+
return Implementation, nil
59+
})
5460
```
5561

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

0 commit comments

Comments
 (0)