Skip to content

Commit 5818115

Browse files
authored
Update README.md (#28)
Signed-off-by: Pavel Patrin <[email protected]>
1 parent 44aa79a commit 5818115

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

README.md

+36
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,42 @@ There are several predefined by container service types that may be used as a de
108108
inside service container between services or outside from the client code.
109109
1. The `gontainer.Resolver` service provides a service to resolve dependencies dynamically.
110110

111+
### Container Interface
112+
113+
```go
114+
// Container defines service container interface.
115+
type Container interface {
116+
// Start initializes every service in the container.
117+
Start() error
118+
119+
// Close closes service container with all services.
120+
// Blocks invocation until the container is closed.
121+
Close() error
122+
123+
// Done is closing after closing of all services.
124+
Done() <-chan struct{}
125+
126+
// Factories returns all defined factories.
127+
Factories() []*Factory
128+
129+
// Services returns all spawned services.
130+
Services() []any
131+
132+
// Events returns events broker instance.
133+
Events() Events
134+
135+
// Resolver returns service resolver instance.
136+
// If container is not started, only requested services
137+
// will be spawned on `resolver.Resolve(...)` call.
138+
Resolver() Resolver
139+
140+
// Invoke invokes specified function.
141+
// If container is not started, only requested services
142+
// will be spawned to invoke the func.
143+
Invoke(fn any) ([]any, error)
144+
}
145+
```
146+
111147
### Services
112148

113149
A service is a functional component of the application, created and managed by a Service Factory.

0 commit comments

Comments
 (0)