Documentation ¶
Index ¶
- Constants
- func Camel1Low(norm []string) string
- func Camel1Up(norm []string) string
- func CapWord(w string) string
- func Convert(name string, from Normalize, to Denormalize) string
- func ConvertX(name string, from Normalize, x Transform, to Denormalize) string
- func Uncamel(str string) (norm []string)
- type Conversion
- type Denormalize
- type Normalize
- type Transform
Constants ¶
View Source
const ( // Lisp is the separator for lisp-like (kebab case) naming // convetions Lisp = "-" // Snake is the separator for C-like (snake case) naming // convetions Snake = "_" )
Variables ¶
This section is empty.
Functions ¶
func Convert ¶
func Convert(name string, from Normalize, to Denormalize) string
Convert converts a given name by first normlizing it from its current naming convetion and then denormalizing its to the target naming convetnion.
Types ¶
type Conversion ¶
type Conversion struct { Norm Normalize Xform Transform Denorm Denormalize }
func SepConvention ¶
func SepConvention(separator string) Conversion
func SepXConvention ¶
func SepXConvention(x Transform, separator string) Conversion
func (*Conversion) Convert ¶
func (cnv *Conversion) Convert(str string) string
type Denormalize ¶
Denormalie functions convert names from the normalized form to a naming convention, i.e. it reverses the effect of a Normalize function.
func Sep ¶
func Sep(separator string) Denormalize
func XDenorm ¶
func XDenorm(x Transform, d Denormalize) Denormalize
type Normalize ¶
Normalize functions convert names from some naming convetion to the normalized form, i.e. an array of strings - each containing one word of the name.
type Transform ¶
Transform the normalized name. Can be used for up-/downcase conversion or adding pre- or postfixes.
func PerSegment ¶
PerSegment creates a Transform function that replaces each name segment s in place with the result of x(s).
Click to show internal directories.
Click to hide internal directories.