bosun.org@v0.0.0-20250213104149-b8d3e981f37d/name/name.go (about) 1 // Package 'name' contains contracts and functionality to help with naming things. 2 package name 3 4 // Validator is an interface which declares operations associated with name validation. 5 // 6 // IsValid returns true if the provided name is valid. 7 type Validator interface { 8 IsValid(name string) bool 9 } 10 11 // RuneLevelValidator is Validator which can also validate isolated runes within a name. 12 // 13 // IsRuneValid returns true if the provided rune is a valid component of a name 14 type RuneLevelValidator interface { 15 Validator 16 IsRuneValid(r rune) bool 17 } 18 19 // Formatter is an interface which defines operations for types which can format names. 20 // 21 // FormatName takes a name, formats it and then returns the result. 22 type Formatter interface { 23 FormatName(name string) (string, error) 24 } 25 26 // Processor is a Validator and Formatter. 27 type Processor interface { 28 Validator 29 Formatter 30 } 31 32 // RuneLevelProcessor is a RuneLevelValidator and Formatter. 33 type RuneLevelProcessor interface { 34 RuneLevelValidator 35 Formatter 36 }