ResolvePrefix retrieve an entity matching an id prefix. It fails if multiple entities match.
(prefix string)
| 379 | // ResolvePrefix retrieve an entity matching an id prefix. It fails if multiple |
| 380 | // entities match. |
| 381 | func (sc *SubCache[EntityT, ExcerptT, CacheT]) ResolvePrefix(prefix string) (CacheT, error) { |
| 382 | return sc.ResolveMatcher(func(excerpt ExcerptT) bool { |
| 383 | return excerpt.Id().HasPrefix(prefix) |
| 384 | }) |
| 385 | } |
| 386 | |
| 387 | func (sc *SubCache[EntityT, ExcerptT, CacheT]) ResolveMatcher(f func(ExcerptT) bool) (CacheT, error) { |
| 388 | id, err := sc.resolveMatcher(f) |
no test coverage detected