Documentation ΒΆ
Index ΒΆ
Constants ΒΆ
This section is empty.
Variables ΒΆ
This section is empty.
Functions ΒΆ
func CreateVarNameFromParams ΒΆ
func CreateVarNameFromParams(p *NameParams) string
CreateVarNameFromParams takes a lengthy title string and attempts to generate a condensed but still recognizable variable name
func CreateVarNameFromString ΒΆ
CreateVarNameFromString does the same as CreateVarNameFromParams but uses a set of default settings and only reuires a string as an input
func MakeNameUnique ΒΆ
MakeNameUnique takes a name, evaluates it against a set of existing names and returns a unique name by appending an underscore and number to the end Each time the function generates a new name, the name is added to the existing map
Types ΒΆ
type NameCase ΒΆ
type NameCase int
NameCase refers to one of a set of casing schemes such as camel, snake, kebab
type NameParams ΒΆ
type NameParams struct { InputName string // dictionary of strings to filter out SkipWords *map[string]bool // dictioanry of strings to be substitute Substitutions *map[string]string // delimiter to use as word boundary Delim string // maximum lenth used MaxLen int // the if you want to override the replacement values with "", set to true RemoveOnly bool // if we should not allow words to occur repeated times, set to true NoRepeats bool // a choice of Left, Right, or Edge specifies which region of the input to prioritize Alignment TextAlignment // a choice of Camel, Snake, or Kebab to determine the name-casing NameCasing NameCase }
NameParams is a convenience parameter struct made for CreateVarNameFromParams
func NewNameParams ΒΆ
func NewNameParams(name string) *NameParams
NewNameParams creates a pointer to a new NameParams struct and populates it with a set of default options
type TextAlignment ΒΆ
type TextAlignment int
TextAlignment refers to which section of text we want to prioritize
const ( // Left keeps left-most text and truncates anything after a specified limit is exceeded Left TextAlignment = iota // Right keeps right-most text and truncates anything after a specified limit is exceeded Right // Edge keeps outer text and truncates any interior text after a specified limit is exceeded Edge )