An inflection engine for golang
Switch branches/tags
Nothing to show
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
name Resource generation with wrong name fixes #11 Dec 10, 2018
.gitignore updated deps, release tool, and package doc Oct 7, 2018
.gometalinter.json updated deps, release tool, and package doc Oct 7, 2018
.travis.yml fix travis yml Nov 14, 2018
LICENSE.txt added a README, LICENSE, and travis Jul 28, 2018
Makefile updated deps, release tool, and package doc Oct 7, 2018
README.md updated README Jul 28, 2018
acronyms.go adding acronyms mutex Nov 5, 2018
camelize.go fixes id Oct 2, 2018
camelize_test.go added a Name method Jul 28, 2018
capitalize.go the Ident methods return Ident instead of strings Jul 28, 2018
capitalize_test.go moved stuff to do with "naming" things to a new package Jul 28, 2018
custom_data.go adding acronyms mutex Nov 5, 2018
dasherize.go fixed lint issues Jul 28, 2018
dasherize_test.go dasherize Jul 28, 2018
flect.go adding acronyms in a separate package Nov 3, 2018
flect_test.go Resource generation with wrong name fixes #11 Dec 10, 2018
go.mod Resource generation with wrong name fixes #11 Dec 10, 2018
go.sum Resource generation with wrong name fixes #11 Dec 10, 2018
ident.go Merge branch 'master' into feature/achronyms-underscore Nov 4, 2018
ident_test.go Fix acronyms followed by uppercase letters, e.g. `JWTName` (#8) Nov 4, 2018
lower_upper.go removed the basic ToLower and ToUpper mappings Jul 28, 2018
lower_upper_test.go added convience wrappers around ToLower and ToUpper Jul 28, 2018
ordinalize.go add Ordinalize Jul 28, 2018
ordinalize_test.go add Ordinalize Jul 28, 2018
pascalize.go the Ident methods return Ident instead of strings Jul 28, 2018
pascalize_test.go fixes id Oct 2, 2018
plural_rules.go Resource generation with wrong name fixes #11 Dec 10, 2018
pluralize.go the Ident methods return Ident instead of strings Jul 28, 2018
pluralize_test.go Initial commit Jul 27, 2018
rule.go Initial commit Jul 27, 2018
singular_rules.go moved stuff to do with "naming" things to a new package Jul 28, 2018
singularize.go the Ident methods return Ident instead of strings Jul 28, 2018
singularize_test.go Initial commit Jul 27, 2018
titleize.go the Ident methods return Ident instead of strings Jul 28, 2018
titleize_test.go added a Name method Jul 28, 2018
underscore.go the Ident methods return Ident instead of strings Jul 28, 2018
underscore_test.go allowing to set acronyms on the inflections.json Nov 1, 2018
version.go adding some missing comments Nov 4, 2018

README.md

Flect

GoDoc Build Status Go Report Card

This is a new inflection engine to replace https://github.com/markbates/inflect designed to be more modular, more readable, and easier to fix issues on than the original.

Installation

$ go get -u -v github.com/gobuffalo/flect

github.com/gobuffalo/flect

GoDoc

The github.com/gobuffalo/flect package contains "basic" inflection tools, like pluralization, singularization, etc...

The Ident Type

In addition to helpful methods that take in a string and return a string, there is an Ident type that can be used to create new, custom, inflection rules.

The Ident type contains two fields.

  • Original - This is the original string that was used to create the Ident
  • Parts - This is a []string that represents all of the "parts" of the string, that have been split apart, making the segments easier to work with

Examples of creating new inflection rules using Ident can be found in the github.com/gobuffalo/flect/name package.

github.com/gobuffalo/flect/name

GoDoc

The github.com/gobuffalo/flect/name package contains more "business" inflection rules like creating proper names, table names, etc...