util

package
v0.0.0-...-4aae350 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSlashForComments

func AddSlashForComments(s string) string

AddSlashForComments can adjust the format of multi-line comments

func BaseName

func BaseName(include, subFixToTrim string) string

BaseName get base name for path. ex: "github.com/p.s.m" => "p.s.m"

func BaseNameAndTrim

func BaseNameAndTrim(include string) string

func Bytes2Str

func Bytes2Str(in []byte) (out string)

FIXME: 后面改为用hertz internal下的

func CamelString

func CamelString(s string) string

CamelString converts the string 's' to a camel string

func CopyString2StringMap

func CopyString2StringMap(from, to map[string]string)

func CopyStringSlice

func CopyStringSlice(from, to *[]string)

func GetBuildGoPaths

func GetBuildGoPaths() []string

GetBuildGoPaths returns the list of Go path directories.

func GetColonPair

func GetColonPair(str string) (string, string)

func GetFirstKV

func GetFirstKV(m map[string][]string) (string, []string)

func GetGOPATH

func GetGOPATH() (gopath string, err error)

func ImportToPath

func ImportToPath(path, subFix string) string

func ImportToPathAndConcat

func ImportToPathAndConcat(path, subFix string) string

func InitGoMod

func InitGoMod(module string) error

func MapForm

func MapForm(input []string) (map[string][]string, error)

func PackArgs

func PackArgs(c interface{}) (res []string, err error)

func PathExist

func PathExist(path string) (bool, error)

func PathToImport

func PathToImport(path, subFix string) string

func RelativePath

func RelativePath(path string) (string, error)

func SearchGoMod

func SearchGoMod(cwd string, recurse bool) (moduleName, path string, found bool)

SearchGoMod searches go.mod from the given directory (which must be an absolute path) to the root directory. When the go.mod is found, its module name and path will be returned.

func SnakeString

func SnakeString(s string) string

SnakeString converts the string 's' to a snake string

func SplitGoTags

func SplitGoTags(input string) []string

func SplitPackage

func SplitPackage(pkg, subFixToTrim string) string

func SplitPackageName

func SplitPackageName(pkg, subFixToTrim string) string

func Str2Bytes

func Str2Bytes(in string) (out []byte)

FIXME: 后面改为用hertz internal下的

func SubDir

func SubDir(root, subPkg string) string

func SubPackage

func SubPackage(mod, dir string) string

func ToCamelCase

func ToCamelCase(name string) string

func ToSnakeCase

func ToSnakeCase(name string) string

func ToVarName

func ToVarName(paths []string) string

func TrimLastChar

func TrimLastChar(s string) string

TrimLastChar can remove the last char for s

func UnpackArgs

func UnpackArgs(args []string, c interface{}) error

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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