flect: github.com/gobuffalo/flect/name Index | Files

package name

import "github.com/gobuffalo/flect/name"

Index

Package Files

char.go file.go folder.go ident.go interface.go join.go key.go name.go os_path.go package.go param_id.go resource.go tablize.go url.go var_case.go

func Char Uses

func Char(s string) string

Char returns the first letter, lowered

"" = "x"
"foo" = "f"
"123d456" = "d"

func File Uses

func File(s string, exts ...string) string

File creates a suitable file name

admin/widget = admin/widget
foo_bar = foo_bar
U$ser = u_ser

func FilePathJoin Uses

func FilePathJoin(names ...string) string

func Folder Uses

func Folder(s string, exts ...string) string

Folder creates a suitable folder name

admin/widget = admin/widget
foo_bar = foo_bar
U$ser = u_ser

func Group Uses

func Group(s string) string

Group pascalizes and pluralizes the string

person = People
foo_bar = FooBars
admin/widget = AdminWidgets

func Key Uses

func Key(s string) string

func OsPath Uses

func OsPath(s string) string

func Package Uses

func Package(s string) string

Package will attempt to return a package version of the name

$GOPATH/src/foo/bar = foo/bar
$GOPATH\src\foo\bar = foo/bar
foo/bar = foo/bar

func ParamID Uses

func ParamID(s string) string

ParamID returns the string as parameter with _id added

user = user_id
UserID = user_id
admin/widgets = admin_widgets_id

func Proper Uses

func Proper(s string) string

Proper pascalizes and singularizes the string

person = Person
foo_bar = FooBar
admin/widgets = AdminWidget

func Tableize Uses

func Tableize(s string) string

Tableize returns an underscore, pluralized string

User = users
Person = persons
Admin/Widget = admin_widgets

func VarCase Uses

func VarCase(s string) string

VarCase version of a name.

foo_bar = fooBar
admin/widget = adminWidget
Users = users

func VarCasePlural Uses

func VarCasePlural(s string) string

VarCasePlural version of a name.

foo_bar = fooBars
admin/widget = adminWidgets
User = users

func VarCaseSingle Uses

func VarCaseSingle(s string) string

VarCaseSingle version of a name.

foo_bar = fooBar
admin/widget = adminWidget
User = users

type Ident Uses

type Ident struct {
    flect.Ident
}

Ident represents the string and it's parts

func Interface Uses

func Interface(x interface{}) (Ident, error)

func New Uses

func New(s string) Ident

New creates a new Ident from the string

func (Ident) Char Uses

func (i Ident) Char() Ident

Char returns the first letter, lowered

"" = "x"
"foo" = "f"
"123d456" = "d"

func (Ident) File Uses

func (i Ident) File(exts ...string) Ident

File creates a suitable file name

admin/widget = admin/widget
foo_bar = foo_bar
U$ser = u_ser

func (Ident) FilePathJoin Uses

func (i Ident) FilePathJoin(ni ...Ident) Ident

func (Ident) Folder Uses

func (i Ident) Folder(exts ...string) Ident

Folder creates a suitable folder name

admin/widget = admin/widget
foo_bar = foo/bar
U$ser = u/ser

func (Ident) Group Uses

func (i Ident) Group() Ident

Group pascalizes and pluralizes the string

person = People
foo_bar = FooBars
admin/widget = AdminWidgets

func (Ident) Key Uses

func (i Ident) Key() Ident

func (Ident) MarshalText Uses

func (i Ident) MarshalText() ([]byte, error)

func (Ident) OsPath Uses

func (i Ident) OsPath() Ident

func (Ident) Package Uses

func (i Ident) Package() Ident

Package will attempt to return a package version of the name

$GOPATH/src/foo/bar = foo/bar
$GOPATH\src\foo\bar = foo/bar
foo/bar = foo/bar

func (Ident) ParamID Uses

func (i Ident) ParamID() Ident

ParamID returns the string as parameter with _id added

user = user_id
UserID = user_id
admin/widgets = admin_widget_id

func (Ident) Proper Uses

func (i Ident) Proper() Ident

Proper pascalizes and singularizes the string

person = Person
foo_bar = FooBar
admin/widgets = AdminWidget

func (Ident) Resource Uses

func (n Ident) Resource() Ident

Resource version of a name

func (Ident) Tableize Uses

func (i Ident) Tableize() Ident

Tableize returns an underscore, pluralized string

User = users
Person = persons
Admin/Widget = admin_widgets

func (Ident) URL Uses

func (n Ident) URL() Ident

func (*Ident) UnmarshalText Uses

func (i *Ident) UnmarshalText(data []byte) error

func (Ident) VarCase Uses

func (i Ident) VarCase() Ident

VarCase version of a name.

foo_bar = fooBar
admin/widget = adminWidget
Users = users

func (Ident) VarCasePlural Uses

func (i Ident) VarCasePlural() Ident

VarCasePlural version of a name.

foo_bar = fooBars
admin/widget = adminWidgets
User = users

func (Ident) VarCaseSingle Uses

func (i Ident) VarCaseSingle() Ident

VarCaseSingle version of a name.

foo_bar = fooBar
admin/widget = adminWidget
User = users

Package name imports 10 packages (graph) and is imported by 27 packages. Updated 2019-08-21. Refresh now. Tools for package owners.