util

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FuncMap = template.FuncMap{
		"snake":          Snake,
		"camel":          Camel,
		"pascal":         Pascal,
		"protoPascal":    ProtoPascal,
		"upper":          strings.ToUpper,
		"lower":          strings.ToLower,
		"plural":         Plural,
		"add":            Add,
		"getPackageName": GetPackageName,
		"goType":         GoType,
	}
)

Functions

func Add

func Add(xs ...int) int

func Camel

func Camel(s string) string

Camel converts the given name into a camelCase.

user_info  => userInfo
full_name  => fullName
user_id    => userID
full-admin => fullAdmin

func GetPackageName

func GetPackageName(name string) string

GetPackageName 获取包名

func GoType added in v0.0.5

func GoType(in parser.Type) string

func Pascal

func Pascal(s string) string

Pascal converts the given name into a PascalCase.

user_info 	=> UserInfo
full_name 	=> FullName
user_id   	=> UserID
full-admin	=> FullAdmin

func Plural

func Plural(name string) string

plural a name.

func ProtoPascal

func ProtoPascal(s string) string

ProtoPascal converts the given name into a proto PascalCase, ignore any acronyms.

user_info 	=> UserInfo
full_name 	=> FullName
user_id   	=> UserId
full-admin	=> FullAdmin

func Snake

func Snake(s string) string

Snake converts the given struct or field name into a snake_case.

Username => username
FullName => full_name
HTTPCode => http_code

Types

This section is empty.

Jump to

Keyboard shortcuts

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