utils

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckModuleVersion added in v0.0.12

func CheckModuleVersion(mods ...application.Module) error

CheckModuleVersion 检查各个模块的版本是否一致,如果不是就返回错误

func ComputeFileSHA256sum

func ComputeFileSHA256sum(file fs.Path) (util.Hex, error)

ComputeFileSHA256sum ...

func ComputeFileSHA256sumAFS added in v0.0.14

func ComputeFileSHA256sumAFS(file afs.Path) (util.Hex, error)

ComputeFileSHA256sumAFS ...

func ComputeSHA256sum added in v0.0.14

func ComputeSHA256sum(data []byte) util.Hex

ComputeSHA256sum ...

func CopyFile added in v0.1.1

func CopyFile(src, dst afs.Path, writeOption *afs.Options) (int64, error)

CopyFile 复制文件内容

func GetFileURI added in v0.1.8

func GetFileURI(p afs.Path) string

GetFileURI ...

func InterfaceIsNil added in v0.1.2

func InterfaceIsNil(i any) bool

InterfaceIsNil 判断 i 是否为空

func IsAbsolutePath added in v0.1.2

func IsAbsolutePath(path string) bool

IsAbsolutePath 判断是否为(本地)绝对路径

func NormalizeHex added in v0.1.8

func NormalizeHex(sum util.Hex) util.Hex

NormalizeHex 标准化 hex 的格式

func Unzip added in v0.1.8

func Unzip(src afs.Path, dst afs.Path) error

Unzip ...

Types

type ErrorList added in v0.1.1

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

ErrorList 表示一个可以包含多个错误的列表

func (*ErrorList) All added in v0.1.2

func (inst *ErrorList) All() []error

All 取全部错误

func (*ErrorList) Append added in v0.1.1

func (inst *ErrorList) Append(err error)

Append 添加一个错误到列表末尾

func (*ErrorList) First added in v0.1.1

func (inst *ErrorList) First() error

First 取最第一个错误

func (*ErrorList) Last added in v0.1.1

func (inst *ErrorList) Last() error

Last 取最后一个错误

type GinUtils added in v0.0.14

type GinUtils struct{}

GinUtils ...

func (*GinUtils) HasFlag added in v0.0.14

func (inst *GinUtils) HasFlag(c *gin.Context, name string) bool

HasFlag 判断传入的 query 中是否包含指定的标志位

func (*GinUtils) ParseIDs added in v0.0.14

func (inst *GinUtils) ParseIDs(str string, sep string, fn func(n int)) error

ParseIDs 解析类似“1.2.3.4.5.”的参数

type PathBuilder added in v0.1.2

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

PathBuilder ...

func (*PathBuilder) Append added in v0.1.2

func (inst *PathBuilder) Append(list ...string) *PathBuilder

Append ...

func (*PathBuilder) Create added in v0.1.2

func (inst *PathBuilder) Create() string

Create ...

func (*PathBuilder) CreateAbsolute added in v0.1.2

func (inst *PathBuilder) CreateAbsolute() string

CreateAbsolute ...

func (*PathBuilder) Init added in v0.1.2

func (inst *PathBuilder) Init(p string) *PathBuilder

Init ...

func (*PathBuilder) Normalize added in v0.1.2

func (inst *PathBuilder) Normalize() error

Normalize 执行标准化

type PropertiesUtil added in v0.1.0

type PropertiesUtil struct{}

PropertiesUtil ...

func (*PropertiesUtil) GetNameList added in v0.1.0

func (inst *PropertiesUtil) GetNameList(src collection.Properties, prefix string, suffix string) []string

GetNameList 读取 src 中,通过 prefix 和 suffix 指定类型的名单

type SortAdapter added in v0.1.2

type SortAdapter struct {
	SortFn
	Quietly bool // 出现异常时,不要抛出 panic
	// contains filtered or unexported fields
}

SortAdapter ...排序适配器

func (*SortAdapter) Len added in v0.1.2

func (inst *SortAdapter) Len() int

func (*SortAdapter) Less added in v0.1.2

func (inst *SortAdapter) Less(i1, i2 int) bool

func (*SortAdapter) Sort added in v0.1.2

func (inst *SortAdapter) Sort()

Sort 执行排序

func (*SortAdapter) Swap added in v0.1.2

func (inst *SortAdapter) Swap(i1, i2 int)

type SortFn added in v0.1.2

type SortFn struct {
	OnLess func(i1, i2 int) bool
	OnSwap func(i1, i2 int)
	OnLen  func() int
}

SortFn ... 排序函数组

type Strings added in v0.1.1

type Strings struct{}

Strings 一组面向字符串的工具

func (*Strings) TrimToLower added in v0.1.1

func (inst *Strings) TrimToLower(s string) string

TrimToLower 移除两端空白,并准换为小写字符

type URLBuilder added in v0.1.2

type URLBuilder struct {
	Protocol string
	User     string
	Host     string
	Port     int
	Path     string
	Query    string
	Fragment string
}

URLBuilder 一个简单的URL创建工具

func (*URLBuilder) Create added in v0.1.2

func (inst *URLBuilder) Create() string

Create ...

func (*URLBuilder) Init added in v0.1.2

func (inst *URLBuilder) Init(u string)

Init ...

type URLResolver added in v0.1.2

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

URLResolver 是一个简单的URL解析器,如果可以,把相对URL解析为绝对URL

func (*URLResolver) ForDocument added in v0.1.2

func (inst *URLResolver) ForDocument(url string) *URLResolver

ForDocument 设置参考文档的URL

func (*URLResolver) Resolve added in v0.1.2

func (inst *URLResolver) Resolve(url string) string

Resolve 解析传入的URL

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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