tool

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package tool @Time : 2022/1/17 上午9:18 @Author: Jtyoui@qq.com @note : 名字规范工具类

Package tool @Time : 2022/1/17 上午9:40 @Author: Jtyoui@qq.com @note : 反射工具类

Package tool @Time : 2022/1/17 上午9:40 @Author: Jtyoui@qq.com @note : 扫码文件工具类

Package tool @Time : 2022/1/17 上午9:43 @Author: Jtyoui@qq.com @note : 关于字符串的处理工具类

Package tool @Time : 2022/1/17 下午5:51 @Author: Jtyoui@qq.com @note : 类型转化

Index

Constants

View Source
const DefaultName = "__local__"

Variables

This section is empty.

Functions

func CamelCase

func CamelCase(name string) string

CamelCase 骆驼命名法

func Lower

func Lower(name string) string

Lower 全下写

func Pascal

func Pascal(name string) string

Pascal 帕斯卡命名法

func ReflectByValue

func ReflectByValue(object interface{}) reflect.Value

ReflectByValue 根据结构体获取该结构体的值类型, 传入的结构体必须是指针类型

func RemovePtr

func RemovePtr(t reflect.Type) reflect.Type

RemovePtr 去掉指针

func ReplaceSepByFS

func ReplaceSepByFS(path string) string

ReplaceSepByFS 判断是否是非Linux系统,全部的路径符号需要将\转为/ 在Fs中,所有的sep全是/

func SnakeToCamelCase added in v1.3.0

func SnakeToCamelCase(name string) string

SnakeToCamelCase 将蛇形命名转为驼峰命名

func StringToAny

func StringToAny(str string, t reflect.Type) (r reflect.Value, err error)

StringToAny 将字符串转为基本类型

func Title

func Title(name string) string

Title 按标题

func Underline

func Underline(name string) string

Underline 蛇形命名 下划线

func Upper

func Upper(name string) string

Upper 全大写

Types

type GoFileScanner

type GoFileScanner struct {
	// contains filtered or unexported fields
}

func NewGoFileScanner

func NewGoFileScanner(fs *embed.FS) *GoFileScanner

func (*GoFileScanner) GetFilePathByReflect

func (s *GoFileScanner) GetFilePathByReflect(t reflect.Type) string

GetFilePathByReflect 根据反射来获取文件地址路径

func (*GoFileScanner) GetMethods

func (s *GoFileScanner) GetMethods(name string) []Method

func (*GoFileScanner) ParseFile

func (s *GoFileScanner) ParseFile(filename string) error

type Method

type Method struct {
	Comments   []string
	MethodName string
	StructName string
	Params     []string
}

type NameTo

type NameTo struct {
	Name string
}

func NewNameTo

func NewNameTo(name string) *NameTo

func (*NameTo) CamelCase

func (n *NameTo) CamelCase() string

CamelCase 骆驼命名法

func (*NameTo) Lower

func (n *NameTo) Lower() string

Lower 全下写

func (*NameTo) Pascal

func (n *NameTo) Pascal() string

Pascal 帕斯卡命名法

func (*NameTo) Title

func (n *NameTo) Title() string

Title 按标题

func (*NameTo) Underline

func (n *NameTo) Underline() string

Underline 蛇形命名 下划线

func (*NameTo) Upper

func (n *NameTo) Upper() string

Upper 全大写

Jump to

Keyboard shortcuts

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