golazy.dev
–
golazy.dev
/
lazysupport
/
inflection
Index
|
Files
package inflection ¶
import "golazy.dev/lazysupport/inflection"
Variables ¶
var Default ¶
var Default = newDefaultInflector()
Functions ¶
func Camelize ¶
func Camelize(term string) string
func Dasherize ¶
func Dasherize(term string) string
func ForeignKey ¶
func ForeignKey(term string) string
func Irregular ¶
Irregular registers a singular/plural pair on the default inflector.
Call it from package initialization before code derives conventional names.
func Irregular(singular string, plural string)
func Ordinal ¶
func Ordinal(number int64) string
func Ordinalize ¶
func Ordinalize(number int64) string
func Pluralize ¶
func Pluralize(singular string) string
func Singularize ¶
func Singularize(plural string) string
func Tableize ¶
func Tableize(term string) string
func Underscorize ¶
func Underscorize(term string) string
Types ¶
type Inflector ¶
type Inflector struct {
// contains filtered or unexported fields
}
func (i *Inflector) Camelize ¶
func (i *Inflector) Camelize(term string) string
func (i *Inflector) Irregular ¶
Irregular registers a singular/plural pair on this inflector.
func (i *Inflector) Irregular(singular string, plural string)
func (i *Inflector) Pluralize ¶
func (i *Inflector) Pluralize(singular string) string
func (i *Inflector) Singularize ¶
func (i *Inflector) Singularize(plural string) string
func (i *Inflector) Underscorize ¶
func (i *Inflector) Underscorize(term string) string
Package inflection contains word and naming helpers used by GoLazy conventions.
lazyroutes uses these helpers to infer REST resource names. Applications can use the package directly when they need the same singular, plural, or naming behavior without importing the router. Applications with domain-specific words can register Irregular rules during package initialization before routes or other conventional names are derived.