tool

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const FileSep = string(os.PathSeparator)

Variables

This section is empty.

Functions

func FileNumInDir

func FileNumInDir(dir string) int

func FileWalk

func FileWalk(dir string, onlyDir bool, fn func(absPath string, fileInfo os.FileInfo) bool)

FileWalk fn, if the return value is false, it won't continue to walk

func GetCurrentAbPathByCaller

func GetCurrentAbPathByCaller() string

func GetRootDir

func GetRootDir() string

func GetValueFromType

func GetValueFromType(e ast.Expr) string

GetValueFromType Get value from the `*ast.Ident`/`*ast.SelectorExpr`/`*ast.StarExpr` TODO handle the map / slice / func

func HandleError

func HandleError(e error)

HandleError panic directly

func HandleErrorWithMsg

func HandleErrorWithMsg(e error, msg ...string)

func IfF

func IfF(condition bool, resultF func())

func ImportName

func ImportName(i string) string

ImportName get the import name from the import spec value

func Info

func Info(msg string, fields ...zap.Field)

func Panic

func Panic(msg string, fields ...zap.Field)

func PathJoin

func PathJoin(paths ...string) string

PathJoin path.Join()

func PrintDetail

func PrintDetail(objectName string, i interface{})

func Record

func Record(fields ...zap.Field)

func StringsEqual

func StringsEqual(s, t []string) bool

func Timer

func Timer(name string, fn func())

func Times

func Times(t int, f func(int))

func ToMap

func ToMap[T comparable](a []T) map[T]struct{}

ToMap More functions like it, visit: https://github.com/samber/lo

func TypeString

func TypeString(i interface{}) string

func Warn

func Warn(msg string, fields ...zap.Field)

Types

type ConfigChecker

type ConfigChecker struct {
}

func (ConfigChecker) CheckInterface

func (c ConfigChecker) CheckInterface(interfaceName string, method string, returnDefaultValues string)

CheckInterface check the method and the return default values accord the method, if the interface name isn't empty

func (ConfigChecker) CheckModuleName

func (c ConfigChecker) CheckModuleName(module string)

CheckModuleName the module shouldn't be empty

func (ConfigChecker) CheckProjectDir

func (c ConfigChecker) CheckProjectDir(dir string)

CheckProjectDir check whether the dir param is existed and valid

func (ConfigChecker) CheckWritePaths

func (c ConfigChecker) CheckWritePaths(paths []string)

CheckWritePaths the path should be "xxxx,xxxx"

type EmptyStruct

type EmptyStruct = struct{}

Jump to

Keyboard shortcuts

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