MCPcopy Create free account
hub / github.com/goadesign/goa / HashedUnique

Method HashedUnique

codegen/scope.go:44–51  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
44func (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

Callers 6

analyzeMethod · 0.95
GoFullTypeNameMethod · 0.95
analyzeMethod · 0.95
buildPayloadDataMethod · 0.80
buildResponsesMethod · 0.80
protoBufFullMessageNameFunction · 0.80

Calls 2

UniqueMethod · 0.95
HashMethod · 0.65

Tested by

no test coverage detected