util

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

View Source
const KChain = `

func (Output *${class}) ${argPublic}(t ${type}) *${class} {
	Output.${argPrivate} = t
	return Output
}

`

Variables

View Source
var EnableGoTidy bool

Functions

func CamelCase2SnackCase

func CamelCase2SnackCase(code string) string

func DoGoFmt

func DoGoFmt(filepath string) error

func DoGoGet

func DoGoGet(packageName string) error

func DoGoModTidy

func DoGoModTidy() error

func EnsureFileDirExist

func EnsureFileDirExist(filedir string) error

func GenerateMethodByChainStyle

func GenerateMethodByChainStyle(t interface{}, fromPath string, toPath string) error

GenerateMethodByChainStyle 根据struct字段自动生成对应的链式访问方法,注意生成链式访问后,原本public的字段会自动变成private

func IsDir

func IsDir(filePath string) bool

IsDir 通过是否含有后缀名来判断是否为文件夹

func IsUpper

func IsUpper(ch uint8) bool

func PascalCase2SnackCase

func PascalCase2SnackCase(code string) string

func SaveAction

func SaveAction(savePath, packName string, importsInfo, contents []string) error

func SaveFile

func SaveFile(filepath string, content string) error

func SnackCase2CamelCase

func SnackCase2CamelCase(name string) string

func SnackCase2PascalCase

func SnackCase2PascalCase(name string) string

func Sscanf

func Sscanf(str, format string, args ...*string) error

Sscanf 以'$'作为format串中字符串的占位符,将str里的内容按照format的形式,将其中的$占位的内容以字符串的形式解析到args参数中

func ToLower

func ToLower(ch uint8) uint8

func ToUpper

func ToUpper(ch uint8) uint8

func UpdateFromStruct

func UpdateFromStruct(v interface{}, tagKey string, handler ParseTagHandler) error

Types

type Element

type Element struct {
	EName string
	EType string
	ETag  string
}

func (*Element) Name

func (e *Element) Name() string

func (*Element) Tag

func (e *Element) Tag() string

func (*Element) Type

func (e *Element) Type() string

type ParseTagHandler

type ParseTagHandler func(structName, fieldName, tagName string)

type Set

type Set[T comparable] map[T]struct{}

func (*Set[T]) Contains

func (s *Set[T]) Contains(v T) bool

func (*Set[T]) Insert

func (s *Set[T]) Insert(v T)

type StrHandleByChain

type StrHandleByChain struct {
	Str string
}

func (*StrHandleByChain) ReplaceAll

func (s *StrHandleByChain) ReplaceAll(old, new string) *StrHandleByChain

Jump to

Keyboard shortcuts

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