HashedUnique builds the unique name for key using name and - if not unique - appending suffix and - if still not unique - a counter value. It returns the same value when called multiple times for a key returning the same hash.
(key Hasher, name string, suffix ...string)
| 42 | // appending suffix and - if still not unique - a counter value. It returns |
| 43 | // the same value when called multiple times for a key returning the same hash. |
| 44 | func (s *NameScope) HashedUnique(key Hasher, name string, suffix ...string) string { |
| 45 | if n, ok := s.names[key.Hash()]; ok { |
| 46 | return n |
| 47 | } |
| 48 | name = s.Unique(name, suffix...) |
| 49 | s.names[key.Hash()] = name |
| 50 | return name |
| 51 | } |
| 52 | |
| 53 | // Unique returns a unique name for the given name. A suffix is appended to the |
| 54 | // name if given name is not unique. If suffixed name is still not unique, a |
no test coverage detected