gutils

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const (
	YYYY_MM_DD_HH_MM_SS = "2006-01-02 15:04:05"
	YYYY_MM_DD          = "2006-01-02"
	MM_DD               = "01-02"
	YYYYMMDD            = "20060102"
	MMDD                = "0102"
)

Variables

This section is empty.

Functions

func CamelToSnakeCase added in v1.2.4

func CamelToSnakeCase(input string) string

CamelToSnakeCase 将驼峰命名转换为蛇形

func CreateDir

func CreateDir(dir string) error

func FileExists

func FileExists(filepath string) bool

FileExists 检查文件是否存在

func FirstLetterToLower added in v1.2.0

func FirstLetterToLower(s string) string

func FirstLetterToUpper

func FirstLetterToUpper(s string) string

FirstLetterToUpper 首字母大写

func GetFileExtension added in v1.2.0

func GetFileExtension(name string) string

GetFileExtension 获取文件扩展名

func LinkedListToArray added in v1.2.3

func LinkedListToArray(l *list.List, dest any) error

func PathExists

func PathExists(path string) (bool, error)

func ReplaceIdToID added in v1.2.3

func ReplaceIdToID(str string) string

ReplaceIdToID 将id、Id、iD替换为Id

func SliceDiff

func SliceDiff[T comparable](a, b []T) []T

SliceDiff 返回在 a 中但不在 b 中的元素

func SliceDuplicate

func SliceDuplicate[T comparable](s []T) []T

func SnakeToLowerCamel added in v1.2.1

func SnakeToLowerCamel(s string) string

SnakeToLowerCamel 蛇形转小驼峰

func SnakeToPascal

func SnakeToPascal(s string) string

SnakeToPascal 蛇形转大驼峰

func TimeFormat added in v1.2.3

func TimeFormat(t time.Time, format string) string

func ToJsonString added in v1.2.0

func ToJsonString(v any) string

func Trim

func Trim(str string) string

func TrimFileExtension added in v1.2.0

func TrimFileExtension(name string) string

TrimFileExtension 去除文件扩展名

func VToUint64 added in v1.2.3

func VToUint64(v any) uint64

Types

type TreeNode added in v1.2.3

type TreeNode struct {
	ID       int // 节点的唯一标识符
	ParentID int // 节点的父节点的唯一标识符
	TreeNodeData
	Children []*TreeNode // 节点的子节点
}

TreeNode 结构体表示树的一个节点

func BuildTree added in v1.2.3

func BuildTree(nodes []TreeNode) []*TreeNode

BuildTree 从节点列表构建树

type TreeNodeData added in v1.2.3

type TreeNodeData any

Jump to

Keyboard shortcuts

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