This example demonstrates how to bind a concrete type to an interface using ProvideAs.
What it demonstrates
Registering a concrete implementation against an interface with gioc.ProvideAs[Logger](c, NewConsoleLogger)
A service that depends on the Logger interface, not a concrete type
The container automatically injects the concrete implementation
Code explanation
Logger – an interface with a Log(message string) method
ConsoleLogger – implements Logger
Service – constructor takes Logger (the interface)
ProvideAs[Logger] tells the container: "when someone needs a Logger, use NewConsoleLogger". When Service is resolved, its Logger parameter is matched by type to the interface binding.
This pattern enables:
Decoupling – the service doesn't know which logger implementation it uses
Testability – swap ConsoleLogger for a mock in tests
Flexibility – change implementations without touching service code