Skip to content

Commit 5f820b5

Browse files
committed
update changelog
1 parent 3b0b705 commit 5f820b5

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

docs/reference/changelog.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,45 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3131

3232
- Nothing yet
3333

34+
## [1.2.1] - 2025-01-14
35+
36+
### Added
37+
38+
- Support for registering and resolving primitive types (int, string, bool, etc.) as singleton instances
39+
- Direct registration of primitive values: `collection.AddSingleton(42, godi.Name("answer"))`
40+
41+
### Fixed
42+
43+
- Fixed resolution of services registered with `As(...)` option - interfaces specified via `As` are now properly resolvable
44+
- Fixed type resolution for slices, maps, channels, and functions - these types are now resolved directly instead of as pointers
45+
- Improved handling of non-pointer types in service resolution
46+
47+
### Changed
48+
49+
- Enhanced `determineServiceType[T]()` to handle primitive types correctly
50+
- Improved type resolution logic for collection types (slice, map, chan, func)
51+
52+
### Examples
53+
54+
```go
55+
// Primitive type registration now works
56+
collection.AddSingleton(42, godi.Name("answer"))
57+
collection.AddSingleton("hello world", godi.Name("greeting"))
58+
collection.AddSingleton(true, godi.Name("enabled"))
59+
60+
// Resolution
61+
answer, err := godi.ResolveKeyed[int](provider, "answer")
62+
greeting, err := godi.ResolveKeyed[string](provider, "greeting")
63+
64+
// As(...) option now works correctly
65+
collection.AddSingleton(NewPostgresDB, godi.As(new(Reader), new(Writer)))
66+
reader, err := godi.Resolve[Reader](provider) // Now works!
67+
68+
// Collection types resolved directly
69+
collection.AddSingleton([]string{"a", "b", "c"})
70+
list, err := godi.Resolve[[]string](provider) // Returns []string, not *[]string
71+
```
72+
3473
## [1.2.0] - 2025-01-13
3574

3675
### Added

0 commit comments

Comments
 (0)