Documentation
¶
Overview ¶
Package casing is the single definition of the naming conventions that the casing rules enforce: the Casing enum, its parser, one implementation of "does this name follow that convention" and a converter that proposes the correctly cased name.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Casing ¶
type Casing string
Casing is a naming convention.
const ( // Kebab is lower case words joined by hyphens: pet-owner. Kebab Casing = "kebab-case" // Snake is lower case words joined by underscores: pet_owner. Snake Casing = "snake_case" // Camel is lowerCamelCase: petOwner. Camel Casing = "camelCase" // Pascal is UpperCamelCase: PetOwner. Pascal Casing = "PascalCase" // ScreamingSnake is upper case words joined by underscores: PET_OWNER. ScreamingSnake Casing = "SCREAMING_SNAKE_CASE" // ScreamingKebab is upper case words joined by hyphens: PET-OWNER. ScreamingKebab Casing = "SCREAMING-KEBAB-CASE" // Dot is lower case words joined by dots: pet.owner. Dot Casing = "dot.case" // Lower is lower case letters and digits only, with no separator: petowner. Lower Casing = "lowercase" )
func Parse ¶
Parse converts an option value into a Casing. An unknown value is an UnknownError rather than a silent fallback.
type Set ¶
type Set []Casing
Set is the list of conventions a name may follow; a name is valid when it follows any one of them.
type UnknownError ¶
type UnknownError struct {
// Value is the rejected value.
Value string
}
UnknownError reports a value that names no casing.
func (UnknownError) Error ¶
func (e UnknownError) Error() string
Error implements error and names every allowed value.