Documentation
¶
Index ¶
- func Command() *cobra.Command
- func ID(s string) string
- type FlexStr
- func (n FlexStr) LowerCamelCase() FlexStr
- func (n FlexStr) LowerDashNotation() FlexStr
- func (n FlexStr) LowerDotNotation() FlexStr
- func (n FlexStr) LowerSnakeCase() FlexStr
- func (n FlexStr) ScreamingSnakeCase() FlexStr
- func (n FlexStr) SnakeCase() FlexStr
- func (n FlexStr) Split() (parts []string)
- func (n FlexStr) String() string
- func (n FlexStr) Transform(mod, first FlexStrTransformer, sep string) FlexStr
- func (n FlexStr) UpperCamelCase() FlexStr
- func (n FlexStr) UpperDotNotation() FlexStr
- func (n FlexStr) UpperSnakeCase() FlexStr
- type FlexStrTransformer
- type Opt
- type Parser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FlexStr ¶
type FlexStr string
A FlexStr describes an identifier of an Entity (Message, Field, Enum, Service, Field). It can be converted to multiple forms using the provided helper methods, or a custom transform can be used to modify its behavior.
func (FlexStr) LowerCamelCase ¶
LowerCamelCase converts FlexStr n to lower camelcase, where each part is title-cased and concatenated with no separator except the first which is lower-cased.
func (FlexStr) LowerDashNotation ¶
LowerDashNotation converts FlexStr n to lower-dash-notation, where each part is lower-cased and concatenated with dash.
func (FlexStr) LowerDotNotation ¶
LowerDotNotation converts FlexStr n to lower dot notation, where each part is lower-cased and concatenated with periods.
func (FlexStr) LowerSnakeCase ¶
LowerSnakeCase converts FlexStr n to lower-snake-case, where each part is lower-cased and concatenated with underscores.
func (FlexStr) ScreamingSnakeCase ¶
ScreamingSnakeCase converts FlexStr n to screaming-snake-case, where each part is all-caps and concatenated with underscores.
func (FlexStr) SnakeCase ¶
SnakeCase converts FlexStr n to snake-case, where each part preserves its capitalization and concatenated with underscores.
func (FlexStr) Split ¶
Split breaks apart FlexStr n into its constituent components. Precedence follows dot notation, then underscores (excluding underscore prefixes), then camelcase. Numbers are treated as standalone components.
func (FlexStr) Transform ¶
func (n FlexStr) Transform(mod, first FlexStrTransformer, sep string) FlexStr
Transform applies a transformation to the parts of FlexStr n, returning a new FlexStr. Transformer first is applied to the first part, with mod applied to all subsequent ones. The parts are then concatenated with the separator sep. For optimal efficiency, multiple FlexStrTransformers should be Chained together before calling Transform.
func (FlexStr) UpperCamelCase ¶
UpperCamelCase converts FlexStr n to upper camelcase, where each part is title-cased and concatenated with no separator.
func (FlexStr) UpperDotNotation ¶
UpperDotNotation converts FlexStr n to upper dot notation, where each part is title-cased and concatenated with periods.
func (FlexStr) UpperSnakeCase ¶
UpperSnakeCase converts FlexStr n to upper-snake-case, where each part is title-cased and concatenated with underscores.
type FlexStrTransformer ¶
FlexStrTransformer is a function that mutates a string. Many of the methods in the standard strings package satisfy this signature.
func (FlexStrTransformer) Chain ¶
func (n FlexStrTransformer) Chain(t FlexStrTransformer) FlexStrTransformer
Chain combines the behavior of two Transformers into one. If multiple transformations need to be performed on a FlexStr, this method should be used to reduce it to a single transformation before applying.