Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/clavoie/di
Browse files Browse the repository at this point in the history
  • Loading branch information
clavoie committed Oct 27, 2017
2 parents 9aa32fa + 3907e6f commit 2c8572d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ di can resolve a dependency directly if known. The dependency instance follows t
resolver
```go
var someDependency Dependency
err := resolver.Resolve(&someDependency)
resolveErr := resolver.Resolve(&someDependency)
```

## Curry Funcs
Expand All @@ -50,26 +50,26 @@ parameters the caller would like to supply themselves.
return dep.DoThing(name), name + "!"
}

ifunc, err := resolver.Curry(normalFunc)
// if err
ifunc, resolveErr := resolver.Curry(normalFunc)
// if resolveErr

value, msg := ifunc.(func (string)(int, string))("hello")
// 5, "hello!"
```

## Invoke
```go
err := resolver.Invoke(func (dep Dep){
resolveErr := resolver.Invoke(func (dep Dep){
// do()
})
```

If the func returns an error, and no error is encountered while resolving the dependencies, that error is returned instead

```go
err := resolver.Invoke(func (dep Dep) error {
resolveErr := resolver.Invoke(func (dep Dep) error {
innerErr := dep1.Do()
return innerErr
})
// err == innerErr
// resolveErr.Err == innerErr
```

0 comments on commit 2c8572d

Please sign in to comment.