Skip to content

Commit

Permalink
Merge branch 'master' of github.com:golobby/container
Browse files Browse the repository at this point in the history
  • Loading branch information
miladrahimi committed Apr 15, 2022
2 parents ad1e9d7 + c81fae1 commit 0f2e22f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
GoLobby Container is a lightweight yet powerful IoC (dependency injection) container for Go projects.
It's built neat, easy-to-use, and performance-in-mind to be your ultimate requirement.

Features:
- Singleton and Transient bindings
- Named dependencies (bindings)
- Resolve by functions, variables, and structs
- Must helpers that convert errors to panics
- Global instance for small applications

## Documentation
### Required Go Versions
It requires Go `v1.11` or newer versions.
Expand Down Expand Up @@ -173,6 +180,15 @@ err := container.Call(func(db Database, s Shape) {
})
```

You are able to raise an error in your receiver function, as well.

```go
err := container.Call(func(db Database) error {
return db.Ping()
})
// err could be `db.Ping()` error.
```

Caution: The `Call()` method does not support named bindings.

#### Using Structs
Expand Down

0 comments on commit 0f2e22f

Please sign in to comment.