name

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2024 License: MIT Imports: 10 Imported by: 75 modules, 213 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Char

func Char(s string) string

Char returns the first letter, lowered

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

func File

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

func FilePathJoin(names ...string) string

func Folder

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

Folder returns a suitable folder name. It removes any special characters from the given string `s` and returns a string consists of alpha-numeric characters.

admin/widget --> admin/widget
adminUser --> admin_user
foo_bar --> foo_bar
Admin --> admin
U$ser --> u_ser

func Group

func Group(s string) string

Group pascalizes and pluralizes the string

person = People
foo_bar = FooBars
admin/widget = AdminWidgets

func Key

func Key(s string) string

func OsPath

func OsPath(s string) string

func Package

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

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

func Proper(s string) string

Proper pascalizes and singularizes the string

person = Person
foo_bar = FooBar
admin/widgets = AdminWidget

func Tableize

func Tableize(s string) string

Tableize returns an underscore, pluralized string

User = users
Person = persons
Admin/Widget = admin_widgets

func VarCase

func VarCase(s string) string

VarCase version of a name.

foo_bar = fooBar
admin/widget = adminWidget
Users = users

func VarCasePlural

func VarCasePlural(s string) string

VarCasePlural version of a name.

foo_bar = fooBars
admin/widget = adminWidgets
User = users

func VarCaseSingle

func VarCaseSingle(s string) string

VarCaseSingle version of a name.

foo_bar = fooBar
admin/widget = adminWidget
User = users

Types

type Ident

type Ident struct {
	flect.Ident
}

Ident represents the string and it's parts

func Interface added in v0.1.2

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

func New

func New(s string) Ident

New creates a new Ident from the string

func (Ident) Char

func (i Ident) Char() Ident

Char returns the first letter, lowered

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

func (Ident) File

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

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

func (Ident) Folder

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

Folder returns a suitable folder name. It removes any special characters from the given string `s` and returns a string consists of alpha-numeric characters.

admin/widget --> admin/widget
adminUser --> admin_user
foo_bar --> foo_bar
Admin --> admin
U$ser --> u_ser

func (Ident) Group

func (i Ident) Group() Ident

Group pascalizes and pluralizes the string

person = People
foo_bar = FooBars
admin/widget = AdminWidgets

func (Ident) Key

func (i Ident) Key() Ident

func (Ident) MarshalText

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

func (Ident) OsPath

func (i Ident) OsPath() Ident

func (Ident) Package

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

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

func (i Ident) Proper() Ident

Proper pascalizes and singularizes the string

person = Person
foo_bar = FooBar
admin/widgets = AdminWidget

func (Ident) Resource

func (n Ident) Resource() Ident

Resource version of a name

func (Ident) Tableize

func (i Ident) Tableize() Ident

Tableize returns an underscore, pluralized string

User = users
Person = persons
Admin/Widget = admin_widgets

func (Ident) URL

func (n Ident) URL() Ident

func (*Ident) UnmarshalText

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

func (Ident) VarCase

func (i Ident) VarCase() Ident

VarCase version of a name.

foo_bar = fooBar
admin/widget = adminWidget
Users = users

func (Ident) VarCasePlural

func (i Ident) VarCasePlural() Ident

VarCasePlural version of a name.

foo_bar = fooBars
admin/widget = adminWidgets
User = users

func (Ident) VarCaseSingle

func (i Ident) VarCaseSingle() Ident

VarCaseSingle version of a name.

foo_bar = fooBar
admin/widget = adminWidget
User = users

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL