MCPcopy Index your code
hub / github.com/coder/coder / UniqueNameWith

Function UniqueNameWith

coderd/util/namesgenerator/namesgenerator.go:57–60  ·  view source on GitHub ↗

UniqueNameWith returns a unique name with a custom delimiter. See UniqueName for details on uniqueness guarantees.

(delim string)

Source from the content-addressed store, hash-verified

55// UniqueNameWith returns a unique name with a custom delimiter.
56// See UniqueName for details on uniqueness guarantees.
57func UniqueNameWith(delim string) string {
58 name := NameWith(delim) + strconv.FormatInt(counter.Add(1), 10)
59 return truncate(name, maxNameLen)
60}
61
62// truncate truncates a name to maxLen characters. It assumes the name ends with
63// a numeric suffix and preserves it, truncating the base name portion instead.

Callers 6

RandomUsernameFunction · 0.92
GetRandomNameHyphenatedFunction · 0.92
TestManagedAgentLimitFunction · 0.92
CreateOrganizationFunction · 0.92
UniqueNameFunction · 0.85
TestUniqueNameWithLengthFunction · 0.85

Calls 3

NameWithFunction · 0.85
truncateFunction · 0.85
AddMethod · 0.65

Tested by 2

TestManagedAgentLimitFunction · 0.74
TestUniqueNameWithLengthFunction · 0.68