diff --git a/README.md b/README.md index 66368ae..2194ef4 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@
![Go version](https://img.shields.io/badge/go-v1.16-9cf) -[![Release](https://img.shields.io/badge/release-1.3.2-green.svg)](https://github.com/duke-git/lancet/releases) +[![Release](https://img.shields.io/badge/release-1.3.3-green.svg)](https://github.com/duke-git/lancet/releases) [![GoDoc](https://godoc.org/github.com//duke-git/lancet?status.svg)](https://pkg.go.dev/github.com/duke-git/lancet) [![Go Report Card](https://goreportcard.com/badge/github.com/duke-git/lancet)](https://goreportcard.com/report/github.com/duke-git/lancet) [![test](https://github.com/duke-git/lancet/actions/workflows/codecov.yml/badge.svg?branch=main&event=push)](https://github.com/duke-git/lancet/actions/workflows/codecov.yml) @@ -23,10 +23,10 @@ English | [简体中文](./README_zh-CN.md) ## Feature -- 👏 Comprehensive, efficient and reusable. -- 💪 200+ go util functions, support string, slice, datetime, net, crypt... -- 💅 Only depend on the go standard library. -- 🌍 Unit test for every exported function. +- 👏 Comprehensive, efficient and reusable. +- 💪 200+ go util functions, support string, slice, datetime, net, crypt... +- 💅 Only depend on the go standard library. +- 🌍 Unit test for every exported function. ## Installation @@ -62,25 +62,28 @@ func main() { ``` ## API Documentation + ### 1. Convertor package contains some functions for data convertion. ```go import "github.com/duke-git/lancet/convertor" ``` + #### Function list: -- [ColorHexToRGB](https://github.com/duke-git/lancet/blob/v1/docs/convertor.md#ColorHexToRGB) -- [ColorRGBToHex](https://github.com/duke-git/lancet/blob/v1/docs/convertor.md#ColorRGBToHex) -- [ToBool](https://github.com/duke-git/lancet/blob/v1/docs/convertor.md#ToBool) -- [ToBytes](https://github.com/duke-git/lancet/blob/v1/docs/convertor.md#ToBytes) -- [ToChar](https://github.com/duke-git/lancet/blob/v1/docs/convertor.md#ToChar) -- [ToChannel](https://github.com/duke-git/lancet/blob/v1/docs/convertor.md#ToChannel) -- [ToInt](https://github.com/duke-git/lancet/blob/v1/docs/convertor.md#ToInt) -- [ToJson](https://github.com/duke-git/lancet/blob/v1/docs/convertor.md#ToJson) -- [ToString](https://github.com/duke-git/lancet/blob/v1/docs/convertor.md#ToString) -- [StructToMap](https://github.com/duke-git/lancet/blob/v1/docs/convertor.md#StructToMap) -- [EncodeByte](https://github.com/duke-git/lancet/blob/v1/docs/convertor.md#EncodeByte) -- [DecodeByte](https://github.com/duke-git/lancet/blob/v1/docs/convertor.md#DecodeByte) - + +- [ColorHexToRGB](https://github.com/duke-git/lancet/blob/v1/docs/convertor.md#ColorHexToRGB) +- [ColorRGBToHex](https://github.com/duke-git/lancet/blob/v1/docs/convertor.md#ColorRGBToHex) +- [ToBool](https://github.com/duke-git/lancet/blob/v1/docs/convertor.md#ToBool) +- [ToBytes](https://github.com/duke-git/lancet/blob/v1/docs/convertor.md#ToBytes) +- [ToChar](https://github.com/duke-git/lancet/blob/v1/docs/convertor.md#ToChar) +- [ToChannel](https://github.com/duke-git/lancet/blob/v1/docs/convertor.md#ToChannel) +- [ToInt](https://github.com/duke-git/lancet/blob/v1/docs/convertor.md#ToInt) +- [ToJson](https://github.com/duke-git/lancet/blob/v1/docs/convertor.md#ToJson) +- [ToString](https://github.com/duke-git/lancet/blob/v1/docs/convertor.md#ToString) +- [StructToMap](https://github.com/duke-git/lancet/blob/v1/docs/convertor.md#StructToMap) +- [EncodeByte](https://github.com/duke-git/lancet/blob/v1/docs/convertor.md#EncodeByte) +- [DecodeByte](https://github.com/duke-git/lancet/blob/v1/docs/convertor.md#DecodeByte) + ### 2. Cryptor package is for data encryption and decryption. ```go @@ -88,76 +91,78 @@ import "github.com/duke-git/lancet/cryptor" ``` #### Function list: -- [AesEcbEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#AesEcbEncrypt) -- [AesEcbDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#AesEcbDecrypt) -- [AesCbcEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#AesCbcEncrypt) -- [AesCbcDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#AesCbcDecrypt) -- [AesCtrCrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#AesCtrCrypt) -- [AesCfbEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#AesCfbEncrypt) -- [AesCfbDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#AesCfbDecrypt) -- [AesOfbEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#AesOfbEncrypt) -- [AesOfbDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#AesOfbDecrypt) -- [Base64StdEncode](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#Base64StdEncode) -- [Base64StdDecode](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#Base64StdDecode) -- [DesEcbEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#DesEcbEncrypt) -- [DesEcbDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#DesEcbDecrypt) -- [DesCbcEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#DesCbcEncrypt) -- [DesCbcDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#DesCbcDecrypt) -- [DesCtrCrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#DesCtrCrypt) -- [DesCfbEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#DesCfbEncrypt) -- [DesCfbDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#DesCfbDecrypt) -- [DesOfbEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#DesOfbEncrypt) -- [DesOfbDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#DesOfbDecrypt) -- [HmacMd5](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#HmacMd5) -- [HmacSha1](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#HmacSha1) -- [HmacSha256](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#HmacSha256) -- [HmacSha512](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#HmacSha512) -- [Md5String](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#Md5String) -- [Md5File](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#Md5File) -- [Sha1](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#Sha1) -- [Sha256](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#Sha256) -- [Sha512](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#Sha512) -- [GenerateRsaKey](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#GenerateRsaKey) -- [RsaEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#RsaEncrypt) -- [RsaDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#RsaDecrypt) + +- [AesEcbEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#AesEcbEncrypt) +- [AesEcbDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#AesEcbDecrypt) +- [AesCbcEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#AesCbcEncrypt) +- [AesCbcDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#AesCbcDecrypt) +- [AesCtrCrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#AesCtrCrypt) +- [AesCfbEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#AesCfbEncrypt) +- [AesCfbDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#AesCfbDecrypt) +- [AesOfbEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#AesOfbEncrypt) +- [AesOfbDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#AesOfbDecrypt) +- [Base64StdEncode](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#Base64StdEncode) +- [Base64StdDecode](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#Base64StdDecode) +- [DesEcbEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#DesEcbEncrypt) +- [DesEcbDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#DesEcbDecrypt) +- [DesCbcEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#DesCbcEncrypt) +- [DesCbcDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#DesCbcDecrypt) +- [DesCtrCrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#DesCtrCrypt) +- [DesCfbEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#DesCfbEncrypt) +- [DesCfbDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#DesCfbDecrypt) +- [DesOfbEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#DesOfbEncrypt) +- [DesOfbDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#DesOfbDecrypt) +- [HmacMd5](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#HmacMd5) +- [HmacSha1](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#HmacSha1) +- [HmacSha256](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#HmacSha256) +- [HmacSha512](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#HmacSha512) +- [Md5String](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#Md5String) +- [Md5File](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#Md5File) +- [Sha1](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#Sha1) +- [Sha256](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#Sha256) +- [Sha512](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#Sha512) +- [GenerateRsaKey](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#GenerateRsaKey) +- [RsaEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#RsaEncrypt) +- [RsaDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor.md#RsaDecrypt) ### 3. Datetime package supports date and time format and compare. - ```go import "github.com/duke-git/lancet/datetime" ``` + #### Function list: -- [AddDay](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#AddDay) -- [AddHour](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#AddHour) -- [AddMinute](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#AddMinute) -- [BeginOfMinute](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#BeginOfMinute) -- [BeginOfHour](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#BeginOfHour) -- [BeginOfDay](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#BeginOfDay) -- [BeginOfWeek](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#BeginOfWeek) -- [BeginOfMonth](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#BeginOfMonth) -- [BeginOfYear](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#BeginOfYear) -- [EndOfMinute](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#EndOfMinute) -- [EndOfHour](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#EndOfHour) -- [EndOfDay](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#EndOfDay) -- [EndOfWeek](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#EndOfWeek) -- [EndOfMonth](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#EndOfMonth) -- [EndOfYear](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#EndOfYear) -- [GetNowDate](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#GetNowDate) -- [GetNowTime](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#GetNowTime) -- [GetNowDateTime](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#GetNowDateTime) -- [GetZeroHourTimestamp](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#GetZeroHourTimestamp) -- [GetNightTimestamp](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#GetNightTimestamp) -- [FormatTimeToStr](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#FormatTimeToStr) -- [FormatStrToTime](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#FormatStrToTime) -- [NewUnix](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#NewUnix) -- [NewUnixNow](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#NewUnixNow) -- [NewFormat](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#NewFormat) -- [NewISO8601](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#NewISO8601) -- [ToUnix](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#ToUnix) -- [ToFormat](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#ToFormat) -- [ToFormatForTpl](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#ToFormatForTpl) -- [ToIso8601](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#ToIso8601) + +- [AddDay](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#AddDay) +- [AddHour](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#AddHour) +- [AddMinute](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#AddMinute) +- [BeginOfMinute](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#BeginOfMinute) +- [BeginOfHour](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#BeginOfHour) +- [BeginOfDay](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#BeginOfDay) +- [BeginOfWeek](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#BeginOfWeek) +- [BeginOfMonth](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#BeginOfMonth) +- [BeginOfYear](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#BeginOfYear) +- [EndOfMinute](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#EndOfMinute) +- [EndOfHour](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#EndOfHour) +- [EndOfDay](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#EndOfDay) +- [EndOfWeek](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#EndOfWeek) +- [EndOfMonth](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#EndOfMonth) +- [EndOfYear](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#EndOfYear) +- [GetNowDate](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#GetNowDate) +- [GetNowTime](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#GetNowTime) +- [GetNowDateTime](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#GetNowDateTime) +- [GetZeroHourTimestamp](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#GetZeroHourTimestamp) +- [GetNightTimestamp](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#GetNightTimestamp) +- [FormatTimeToStr](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#FormatTimeToStr) +- [FormatStrToTime](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#FormatStrToTime) +- [NewUnix](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#NewUnix) +- [NewUnixNow](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#NewUnixNow) +- [NewFormat](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#NewFormat) +- [NewISO8601](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#NewISO8601) +- [ToUnix](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#ToUnix) +- [ToFormat](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#ToFormat) +- [ToFormatForTpl](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#ToFormatForTpl) +- [ToIso8601](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#ToIso8601) ### 4. Fileutil package implements some basic functions for file operations. @@ -167,29 +172,31 @@ import "github.com/duke-git/lancet/fileutil" #### Function list: -- [ClearFile](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#ClearFile) -- [CreateFile](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#CreateFile) -- [CreateDir](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#CreateDir) -- [CopyFile](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#CopyFile) -- [FileMode](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#FileMode) -- [MiMeType](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#MiMeType) -- [IsExist](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#IsExist) -- [IsLink](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#IsLink) -- [IsDir](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#IsDir) -- [ListFileNames](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#ListFileNames) -- [RemoveFile](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#RemoveFile) -- [ReadFileToString](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#ReadFileToString) -- [ReadFileByLine](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#ReadFileByLine) -- [Zip](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#Zip) -- [UnZip](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#UnZip) +- [ClearFile](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#ClearFile) +- [CreateFile](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#CreateFile) +- [CreateDir](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#CreateDir) +- [CopyFile](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#CopyFile) +- [FileMode](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#FileMode) +- [MiMeType](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#MiMeType) +- [IsExist](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#IsExist) +- [IsLink](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#IsLink) +- [IsDir](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#IsDir) +- [ListFileNames](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#ListFileNames) +- [RemoveFile](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#RemoveFile) +- [ReadFileToString](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#ReadFileToString) +- [ReadFileByLine](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#ReadFileByLine) +- [Zip](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#Zip) +- [UnZip](https://github.com/duke-git/lancet/blob/v1/docs/fileutil.md#UnZip) ### 5. Formatter contains some functions for data formatting. ```go import "github.com/duke-git/lancet/formatter" ``` + #### Function list: -- [Comma](https://github.com/duke-git/lancet/blob/v1/docs/formatter.md#Comma) + +- [Comma](https://github.com/duke-git/lancet/blob/v1/docs/formatter.md#Comma) ### Function package can control the flow of function execution and support part of functional programming @@ -198,14 +205,14 @@ import "github.com/duke-git/lancet/function" ``` #### Function list: -- [After](https://github.com/duke-git/lancet/blob/v1/docs/function.md#After) -- [Before](https://github.com/duke-git/lancet/blob/v1/docs/function.md#Before) -- [Curry](https://github.com/duke-git/lancet/blob/v1/docs/function.md#Curry) -- [Compose](https://github.com/duke-git/lancet/blob/v1/docs/function.md#Compose) -- [Debounced](https://github.com/duke-git/lancet/blob/v1/docs/function.md#Debounced) -- [Delay](https://github.com/duke-git/lancet/blob/v1/docs/function.md#Delay) -- [Watcher](https://github.com/duke-git/lancet/blob/v1/docs/function.md#Watcher) +- [After](https://github.com/duke-git/lancet/blob/v1/docs/function.md#After) +- [Before](https://github.com/duke-git/lancet/blob/v1/docs/function.md#Before) +- [Curry](https://github.com/duke-git/lancet/blob/v1/docs/function.md#Curry) +- [Compose](https://github.com/duke-git/lancet/blob/v1/docs/function.md#Compose) +- [Debounced](https://github.com/duke-git/lancet/blob/v1/docs/function.md#Debounced) +- [Delay](https://github.com/duke-git/lancet/blob/v1/docs/function.md#Delay) +- [Watcher](https://github.com/duke-git/lancet/blob/v1/docs/function.md#Watcher) ### 6. Mathutil package implements some functions for math calculation. @@ -214,14 +221,14 @@ import "github.com/duke-git/lancet/mathutil" ``` #### Function list: -- [Exponent](https://github.com/duke-git/lancet/blob/v1/docs/mathutil.md#Exponent) -- [Fibonacci](https://github.com/duke-git/lancet/blob/v1/docs/mathutil.md#Fibonacci) -- [Factorial](https://github.com/duke-git/lancet/blob/v1/docs/mathutil.md#Factorial) -- [Percent](https://github.com/duke-git/lancet/blob/v1/docs/mathutil.md#Percent) -- [RoundToFloat](https://github.com/duke-git/lancet/blob/v1/docs/mathutil.md#RoundToFloat) -- [RoundToString](https://github.com/duke-git/lancet/blob/v1/docs/mathutil.md#RoundToString) -- [TruncRound](https://github.com/duke-git/lancet/blob/v1/docs/mathutil.md#TruncRound) +- [Exponent](https://github.com/duke-git/lancet/blob/v1/docs/mathutil.md#Exponent) +- [Fibonacci](https://github.com/duke-git/lancet/blob/v1/docs/mathutil.md#Fibonacci) +- [Factorial](https://github.com/duke-git/lancet/blob/v1/docs/mathutil.md#Factorial) +- [Percent](https://github.com/duke-git/lancet/blob/v1/docs/mathutil.md#Percent) +- [RoundToFloat](https://github.com/duke-git/lancet/blob/v1/docs/mathutil.md#RoundToFloat) +- [RoundToString](https://github.com/duke-git/lancet/blob/v1/docs/mathutil.md#RoundToString) +- [TruncRound](https://github.com/duke-git/lancet/blob/v1/docs/mathutil.md#TruncRound) ### 7. Netutil package contains functions to get net information and send http request. @@ -230,22 +237,22 @@ import "github.com/duke-git/lancet/netutil" ``` #### Function list: -- [ConvertMapToQueryString](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#ConvertMapToQueryString) -- [EncodeUrl](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#EncodeUrl) -- [GetInternalIp](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#GetInternalIp) -- [GetIps](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#GetIps) -- [GetMacAddrs](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#GetMacAddrs) -- [GetPublicIpInfo](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#GetPublicIpInfo) -- [GetRequestPublicIp](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#GetRequestPublicIp) -- [IsPublicIP](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#IsPublicIP) -- [IsInternalIP](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#IsInternalIP) -- [HttpGet](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#HttpGet) -- [HttpDelete](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#HttpDelete) -- [HttpPost](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#HttpPost) -- [HttpPut](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#HttpPut) -- [HttpPatch](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#HttpPatch) -- [ParseHttpResponse](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#ParseHttpResponse) +- [ConvertMapToQueryString](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#ConvertMapToQueryString) +- [EncodeUrl](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#EncodeUrl) +- [GetInternalIp](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#GetInternalIp) +- [GetIps](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#GetIps) +- [GetMacAddrs](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#GetMacAddrs) +- [GetPublicIpInfo](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#GetPublicIpInfo) +- [GetRequestPublicIp](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#GetRequestPublicIp) +- [IsPublicIP](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#IsPublicIP) +- [IsInternalIP](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#IsInternalIP) +- [HttpGet](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#HttpGet) +- [HttpDelete](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#HttpDelete) +- [HttpPost](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#HttpPost) +- [HttpPut](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#HttpPut) +- [HttpPatch](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#HttpPatch) +- [ParseHttpResponse](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#ParseHttpResponse) ### 8. Random package implements some basic functions to generate random int and string. @@ -254,10 +261,15 @@ import "github.com/duke-git/lancet/random" ``` #### Function list: -- [RandBytes](https://github.com/duke-git/lancet/blob/v1/docs/random.md#RandBytes) -- [RandInt](https://github.com/duke-git/lancet/blob/v1/docs/random.md#RandInt) -- [RandString](https://github.com/duke-git/lancet/blob/v1/docs/random.md#RandString) -- [UUIdV4](https://github.com/duke-git/lancet/blob/v1/docs/random.md#UUIdV4) + +- [RandBytes](https://github.com/duke-git/lancet/blob/v1/docs/random.md#RandBytes) +- [RandInt](https://github.com/duke-git/lancet/blob/v1/docs/random.md#RandInt) +- [RandString](https://github.com/duke-git/lancet/blob/v1/docs/random.md#RandString) +- [RandUpper](https://github.com/duke-git/lancet/blob/v1/docs/random.md#RandUpper) +- [RandLower](https://github.com/duke-git/lancet/blob/v1/docs/random.md#RandLower) +- [RandNumeral](https://github.com/duke-git/lancet/blob/v1/docs/random.md#RandNumeral) +- [RandNumeralOrLetter](https://github.com/duke-git/lancet/blob/v1/docs/random.md#RandNumeralOrLetter) +- [UUIdV4](https://github.com/duke-git/lancet/blob/v1/docs/random.md#UUIdV4) ### 9. Retry package is for executing a function repeatedly until it was successful or canceled by the context. @@ -266,11 +278,12 @@ import "github.com/duke-git/lancet/retry" ``` #### Function list: -- [Context](https://github.com/duke-git/lancet/blob/v1/docs/retry.md#Context) -- [Retry](https://github.com/duke-git/lancet/blob/v1/docs/retry.md#Retry) -- [RetryFunc](https://github.com/duke-git/lancet/blob/v1/docs/retry.md#RetryFunc) -- [RetryDuration](https://github.com/duke-git/lancet/blob/v1/docs/retry.md#RetryDuration) -- [RetryTimes](https://github.com/duke-git/lancet/blob/v1/docs/retry.md#RetryTimes) + +- [Context](https://github.com/duke-git/lancet/blob/v1/docs/retry.md#Context) +- [Retry](https://github.com/duke-git/lancet/blob/v1/docs/retry.md#Retry) +- [RetryFunc](https://github.com/duke-git/lancet/blob/v1/docs/retry.md#RetryFunc) +- [RetryDuration](https://github.com/duke-git/lancet/blob/v1/docs/retry.md#RetryDuration) +- [RetryTimes](https://github.com/duke-git/lancet/blob/v1/docs/retry.md#RetryTimes) ### 10. Slice contains some functions to manipulate slice. @@ -279,46 +292,47 @@ import "github.com/duke-git/lancet/slice" ``` #### Function list: -- [AppendIfAbsent](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#AppendIfAbsent) -- [Contain](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Contain) -- [ContainSubSlice](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#ContainSubSlice) -- [Chunk](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Chunk) -- [Compact](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Compact) -- [Concat](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Concat) -- [Count](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Count) -- [Difference](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Difference) -- [DifferenceBy](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#DifferenceBy) -- [DeleteByIndex](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#DeleteByIndex) -- [Drop](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Drop) -- [Every](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Every) -- [Equal](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Equal) -- [EqualWith](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#EqualWith) -- [Filter](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Filter) -- [Find](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Find) -- [FindLast](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#FindLast) -- [FlattenDeep](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#FlattenDeep) -- [ForEach](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#ForEach) -- [GroupBy](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#GroupBy) -- [IntSlice](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#IntSlice) -- [IndexOf](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#IndexOf) -- [LastIndexOf](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#LastIndexOf) -- [InterfaceSlice](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#InterfaceSlice) -- [Intersection](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Intersection) -- [InsertByIndex](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#InsertByIndex) -- [Map](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Map) -- [ReverseSlice](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#ReverseSlice) -- [Reduce](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Reduce) -- [Shuffle](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Shuffle) -- [SortByField](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#SortByField) -- [Some](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Some) -- [StringSlice](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#StringSlice) -- [ToSlice](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#ToSlice) -- [ToSlicePointer](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#ToSlice) -- [Unique](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Unique) -- [UniqueBy](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#UniqueBy) -- [Union](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Union) -- [UpdateByIndex](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#UpdateByIndex) -- [Without](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Without) + +- [AppendIfAbsent](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#AppendIfAbsent) +- [Contain](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Contain) +- [ContainSubSlice](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#ContainSubSlice) +- [Chunk](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Chunk) +- [Compact](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Compact) +- [Concat](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Concat) +- [Count](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Count) +- [Difference](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Difference) +- [DifferenceBy](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#DifferenceBy) +- [DeleteByIndex](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#DeleteByIndex) +- [Drop](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Drop) +- [Every](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Every) +- [Equal](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Equal) +- [EqualWith](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#EqualWith) +- [Filter](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Filter) +- [Find](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Find) +- [FindLast](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#FindLast) +- [FlattenDeep](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#FlattenDeep) +- [ForEach](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#ForEach) +- [GroupBy](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#GroupBy) +- [IntSlice](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#IntSlice) +- [IndexOf](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#IndexOf) +- [LastIndexOf](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#LastIndexOf) +- [InterfaceSlice](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#InterfaceSlice) +- [Intersection](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Intersection) +- [InsertByIndex](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#InsertByIndex) +- [Map](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Map) +- [ReverseSlice](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#ReverseSlice) +- [Reduce](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Reduce) +- [Shuffle](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Shuffle) +- [SortByField](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#SortByField) +- [Some](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Some) +- [StringSlice](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#StringSlice) +- [ToSlice](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#ToSlice) +- [ToSlicePointer](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#ToSlice) +- [Unique](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Unique) +- [UniqueBy](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#UniqueBy) +- [Union](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Union) +- [UpdateByIndex](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#UpdateByIndex) +- [Without](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#Without) ### 11. Strutil package contains some functions to manipulate string. @@ -328,24 +342,24 @@ import "github.com/duke-git/lancet/strutil" #### Function list: -- [After](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#After) -- [AfterLast](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#AfterLast) -- [Before](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#Before) -- [BeforeLast](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#BeforeLast) -- [CamelCase](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#CamelCase) -- [Capitalize](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#Capitalize) -- [IsString](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#IsString) -- [KebabCase](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#KebabCase) -- [LowerFirst](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#LowerFirst) -- [UpperFirst](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#UpperFirst) -- [PadEnd](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#PadEnd) -- [PadStart](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#PadStart) -- [Reverse](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#Reverse) -- [SnakeCase](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#SnakeCase) -- [SplitEx](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#SplitEx) -- [Wrap](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#Wrap) -- [Unwrap](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#Unwrap) - +- [After](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#After) +- [AfterLast](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#AfterLast) +- [Before](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#Before) +- [BeforeLast](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#BeforeLast) +- [CamelCase](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#CamelCase) +- [Capitalize](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#Capitalize) +- [IsString](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#IsString) +- [KebabCase](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#KebabCase) +- [LowerFirst](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#LowerFirst) +- [UpperFirst](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#UpperFirst) +- [PadEnd](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#PadEnd) +- [PadStart](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#PadStart) +- [Reverse](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#Reverse) +- [SnakeCase](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#SnakeCase) +- [SplitEx](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#SplitEx) +- [Wrap](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#Wrap) +- [Unwrap](https://github.com/duke-git/lancet/blob/v1/docs/strutil.md#Unwrap) + ### 12. System package contain some functions about os, runtime, shell command. ```go @@ -353,51 +367,52 @@ import "github.com/duke-git/lancet/system" ``` #### Function list: -- [IsWindows](https://github.com/duke-git/lancet/blob/v1/docs/system.md#IsWindows) -- [IsLinux](https://github.com/duke-git/lancet/blob/v1/docs/system.md#IsLinux) -- [IsMac](https://github.com/duke-git/lancet/blob/v1/docs/system.md#IsMac) -- [GetOsEnv](https://github.com/duke-git/lancet/blob/v1/docs/system.md#GetOsEnv) -- [SetOsEnv](https://github.com/duke-git/lancet/blob/v1/docs/system.md#SetOsEnv) -- [RemoveOsEnv](https://github.com/duke-git/lancet/blob/v1/docs/system.md#RemoveOsEnv) -- [CompareOsEnv](https://github.com/duke-git/lancet/blob/v1/docs/system.md#CompareOsEnv) -- [ExecCommand](https://github.com/duke-git/lancet/blob/v1/docs/system.md#ExecCommand) -- [GetOsBits](https://github.com/duke-git/lancet/blob/v1/docs/system.md#GetOsBits) + +- [IsWindows](https://github.com/duke-git/lancet/blob/v1/docs/system.md#IsWindows) +- [IsLinux](https://github.com/duke-git/lancet/blob/v1/docs/system.md#IsLinux) +- [IsMac](https://github.com/duke-git/lancet/blob/v1/docs/system.md#IsMac) +- [GetOsEnv](https://github.com/duke-git/lancet/blob/v1/docs/system.md#GetOsEnv) +- [SetOsEnv](https://github.com/duke-git/lancet/blob/v1/docs/system.md#SetOsEnv) +- [RemoveOsEnv](https://github.com/duke-git/lancet/blob/v1/docs/system.md#RemoveOsEnv) +- [CompareOsEnv](https://github.com/duke-git/lancet/blob/v1/docs/system.md#CompareOsEnv) +- [ExecCommand](https://github.com/duke-git/lancet/blob/v1/docs/system.md#ExecCommand) +- [GetOsBits](https://github.com/duke-git/lancet/blob/v1/docs/system.md#GetOsBits) ### 13. Validator package contains some functions for data validation. ```go import "github.com/duke-git/lancet/validator" ``` + #### Function list: -- [ContainChinese](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#ContainChinese) -- [ContainLetter](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#ContainLetter) -- [ContainLower](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#ContainLower) -- [ContainUpper](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#ContainUpper) -- [IsAlpha](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsAlpha) -- [IsAllUpper](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsAllUpper) -- [IsAllLower](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsAllLower) -- [IsBase64](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsBase64) -- [IsChineseMobile](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsChineseMobile) -- [IsChineseIdNum](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsChineseIdNum) -- [IsChinesePhone](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsChinesePhone) -- [IsCreditCard](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsCreditCard) -- [IsDns](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsDns) -- [IsEmail](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsEmail) -- [IsEmptyString](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsEmptyString) -- [IsFloatStr](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsFloatStr) -- [IsNumberStr](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsNumberStr) -- [IsJSON](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsJSON) -- [IsRegexMatch](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsRegexMatch) -- [IsIntStr](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsIntStr) -- [IsIp](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsIp) -- [IsIpV4](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsIpV4) -- [IsIpV6](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsIpV6) -- [IsStrongPassword](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsStrongPassword) -- [IsUrl](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsUrl) -- [IsWeakPassword](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsWeakPassword) -- [IsZeroValue](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsZeroValue) - +- [ContainChinese](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#ContainChinese) +- [ContainLetter](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#ContainLetter) +- [ContainLower](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#ContainLower) +- [ContainUpper](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#ContainUpper) +- [IsAlpha](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsAlpha) +- [IsAllUpper](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsAllUpper) +- [IsAllLower](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsAllLower) +- [IsBase64](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsBase64) +- [IsChineseMobile](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsChineseMobile) +- [IsChineseIdNum](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsChineseIdNum) +- [IsChinesePhone](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsChinesePhone) +- [IsCreditCard](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsCreditCard) +- [IsDns](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsDns) +- [IsEmail](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsEmail) +- [IsEmptyString](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsEmptyString) +- [IsFloatStr](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsFloatStr) +- [IsNumberStr](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsNumberStr) +- [IsJSON](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsJSON) +- [IsRegexMatch](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsRegexMatch) +- [IsIntStr](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsIntStr) +- [IsIp](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsIp) +- [IsIpV4](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsIpV4) +- [IsIpV6](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsIpV6) +- [IsStrongPassword](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsStrongPassword) +- [IsUrl](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsUrl) +- [IsWeakPassword](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsWeakPassword) +- [IsZeroValue](https://github.com/duke-git/lancet/blob/v1/docs/validator.md#IsZeroValue) ## How to Contribute @@ -407,4 +422,4 @@ I really appreciate any code commits which make lancet lib powerful. Please foll 2. Create your feature branch. 3. Commit your changes. 4. Push to the branch -5. Create new pull request. \ No newline at end of file +5. Create new pull request. diff --git a/README_zh-CN.md b/README_zh-CN.md index 151ad0e..78f38f5 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -4,7 +4,7 @@
![Go version](https://img.shields.io/badge/go-v1.16-9cf) -[![Release](https://img.shields.io/badge/release-1.3.2-green.svg)](https://github.com/duke-git/lancet/releases) +[![Release](https://img.shields.io/badge/release-1.3.3-green.svg)](https://github.com/duke-git/lancet/releases) [![GoDoc](https://godoc.org/github.com//duke-git/lancet?status.svg)](https://pkg.go.dev/github.com/duke-git/lancet) [![Go Report Card](https://goreportcard.com/badge/github.com/duke-git/lancet)](https://goreportcard.com/report/github.com/duke-git/lancet) [![test](https://github.com/duke-git/lancet/actions/workflows/codecov.yml/badge.svg?branch=main&event=push)](https://github.com/duke-git/lancet/actions/workflows/codecov.yml) @@ -20,13 +20,12 @@ 简体中文 | [English](./README.md) - ## 特性 -- 👏 全面、高效、可复用 -- 💪 200+常用go工具函数,支持string、slice、datetime、net、crypt... -- 💅 只依赖go标准库 -- 🌍 所有导出函数单元测试覆盖率100% +- 👏 全面、高效、可复用 +- 💪 200+常用 go 工具函数,支持 string、slice、datetime、net、crypt... +- 💅 只依赖 go 标准库 +- 🌍 所有导出函数单元测试覆盖率 100% ## 安装 @@ -36,7 +35,7 @@ go get github.com/duke-git/lancet ## 用法 -lancet是以包的结构组织代码的,使用时需要导入相应的包名。例如:如果使用字符串相关函数,需要导入strutil包: +lancet 是以包的结构组织代码的,使用时需要导入相应的包名。例如:如果使用字符串相关函数,需要导入 strutil 包: ```go import "github.com/duke-git/lancet/strutil" @@ -44,7 +43,7 @@ import "github.com/duke-git/lancet/strutil" ## 例子 -此处以字符串工具函数Reverse(逆序字符串)为例,需要导入strutil包: +此处以字符串工具函数 Reverse(逆序字符串)为例,需要导入 strutil 包: ```go package main @@ -61,104 +60,110 @@ func main() { } ``` -## API文档 -### 1. convertor转换器包支持一些常见的数据类型转换。 +## API 文档 + +### 1. convertor 转换器包支持一些常见的数据类型转换。 ```go import "github.com/duke-git/lancet/convertor" ``` + #### 函数列表: -- [ColorHexToRGB](https://github.com/duke-git/lancet/blob/v1/docs/convertor_zh-CN.md#ColorHexToRGB) -- [ColorRGBToHex](https://github.com/duke-git/lancet/blob/v1/docs/convertor_zh-CN.md#ColorRGBToHex) -- [ToBool](https://github.com/duke-git/lancet/blob/v1/docs/convertor_zh-CN.md#ToBool) -- [ToBytes](https://github.com/duke-git/lancet/blob/v1/docs/convertor_zh-CN.md#ToBytes) -- [ToChar](https://github.com/duke-git/lancet/blob/v1/docs/convertor_zh-CN.md#ToChar) -- [ToChannel](https://github.com/duke-git/lancet/blob/v1/docs/convertor_zh-CN.md#ToChannel) -- [ToInt](https://github.com/duke-git/lancet/blob/v1/docs/convertor_zh-CN.md#ToInt) -- [ToJson](https://github.com/duke-git/lancet/blob/v1/docs/convertor_zh-CN.md#ToJson) -- [ToString](https://github.com/duke-git/lancet/blob/v1/docs/convertor_zh-CN.md#ToString) -- [StructToMap](https://github.com/duke-git/lancet/blob/v1/docs/convertor_zh-CN.md#StructToMap) -- [EncodeByte](https://github.com/duke-git/lancet/blob/v1/docs/convertor_zh-CN.md#EncodeByte) -- [DecodeByte](https://github.com/duke-git/lancet/blob/v1/docs/convertor_zh-CN.md#DecodeByte) - -### 2. cryptor加密包支持数据加密和解密,获取md5,hash值。支持base64, md5, hmac, aes, des, rsa。 + +- [ColorHexToRGB](https://github.com/duke-git/lancet/blob/v1/docs/convertor_zh-CN.md#ColorHexToRGB) +- [ColorRGBToHex](https://github.com/duke-git/lancet/blob/v1/docs/convertor_zh-CN.md#ColorRGBToHex) +- [ToBool](https://github.com/duke-git/lancet/blob/v1/docs/convertor_zh-CN.md#ToBool) +- [ToBytes](https://github.com/duke-git/lancet/blob/v1/docs/convertor_zh-CN.md#ToBytes) +- [ToChar](https://github.com/duke-git/lancet/blob/v1/docs/convertor_zh-CN.md#ToChar) +- [ToChannel](https://github.com/duke-git/lancet/blob/v1/docs/convertor_zh-CN.md#ToChannel) +- [ToInt](https://github.com/duke-git/lancet/blob/v1/docs/convertor_zh-CN.md#ToInt) +- [ToJson](https://github.com/duke-git/lancet/blob/v1/docs/convertor_zh-CN.md#ToJson) +- [ToString](https://github.com/duke-git/lancet/blob/v1/docs/convertor_zh-CN.md#ToString) +- [StructToMap](https://github.com/duke-git/lancet/blob/v1/docs/convertor_zh-CN.md#StructToMap) +- [EncodeByte](https://github.com/duke-git/lancet/blob/v1/docs/convertor_zh-CN.md#EncodeByte) +- [DecodeByte](https://github.com/duke-git/lancet/blob/v1/docs/convertor_zh-CN.md#DecodeByte) + +### 2. cryptor 加密包支持数据加密和解密,获取 md5,hash 值。支持 base64, md5, hmac, aes, des, rsa。 ```go import "github.com/duke-git/lancet/cryptor" ``` #### 函数列表: -- [AesEcbEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#AesEcbEncrypt) -- [AesEcbDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#AesEcbDecrypt) -- [AesCbcEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#AesCbcEncrypt) -- [AesCbcDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#AesCbcDecrypt) -- [AesCtrCrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#AesCtrCrypt) -- [AesCfbEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#AesCfbEncrypt) -- [AesCfbDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#AesCfbDecrypt) -- [AesOfbEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#AesOfbEncrypt) -- [AesOfbDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#AesOfbDecrypt) -- [Base64StdEncode](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#Base64StdEncode) -- [Base64StdDecode](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#Base64StdDecode) -- [DesEcbEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#DesEcbEncrypt) -- [DesEcbDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#DesEcbDecrypt) -- [DesCbcEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#DesCbcEncrypt) -- [DesCbcDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#DesCbcDecrypt) -- [DesCtrCrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#DesCtrCrypt) -- [DesCfbEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#DesCfbEncrypt) -- [DesCfbDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#DesCfbDecrypt) -- [DesOfbEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#DesOfbEncrypt) -- [DesOfbDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#DesOfbDecrypt) -- [HmacMd5](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#HmacMd5) -- [HmacSha1](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#HmacSha1) -- [HmacSha256](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#HmacSha256) -- [HmacSha512](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#HmacSha512) -- [Md5String](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#Md5String) -- [Md5File](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#Md5File) -- [Sha1](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#Sha1) -- [Sha256](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#Sha256) -- [Sha512](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#Sha512) -- [GenerateRsaKey](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#GenerateRsaKey) -- [RsaEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#RsaEncrypt) -- [RsaDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#RsaDecrypt) -### 3. datetime日期时间处理包,格式化日期,比较日期。 +- [AesEcbEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#AesEcbEncrypt) +- [AesEcbDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#AesEcbDecrypt) +- [AesCbcEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#AesCbcEncrypt) +- [AesCbcDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#AesCbcDecrypt) +- [AesCtrCrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#AesCtrCrypt) +- [AesCfbEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#AesCfbEncrypt) +- [AesCfbDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#AesCfbDecrypt) +- [AesOfbEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#AesOfbEncrypt) +- [AesOfbDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#AesOfbDecrypt) +- [Base64StdEncode](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#Base64StdEncode) +- [Base64StdDecode](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#Base64StdDecode) +- [DesEcbEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#DesEcbEncrypt) +- [DesEcbDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#DesEcbDecrypt) +- [DesCbcEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#DesCbcEncrypt) +- [DesCbcDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#DesCbcDecrypt) +- [DesCtrCrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#DesCtrCrypt) +- [DesCfbEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#DesCfbEncrypt) +- [DesCfbDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#DesCfbDecrypt) +- [DesOfbEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#DesOfbEncrypt) +- [DesOfbDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#DesOfbDecrypt) +- [HmacMd5](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#HmacMd5) +- [HmacSha1](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#HmacSha1) +- [HmacSha256](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#HmacSha256) +- [HmacSha512](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#HmacSha512) +- [Md5String](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#Md5String) +- [Md5File](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#Md5File) +- [Sha1](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#Sha1) +- [Sha256](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#Sha256) +- [Sha512](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#Sha512) +- [GenerateRsaKey](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#GenerateRsaKey) +- [RsaEncrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#RsaEncrypt) +- [RsaDecrypt](https://github.com/duke-git/lancet/blob/v1/docs/cryptor_zh-CN.md#RsaDecrypt) +### 3. datetime 日期时间处理包,格式化日期,比较日期。 ```go import "github.com/duke-git/lancet/datetime" ``` + #### 函数列表: -- [AddDay](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#AddDay) -- [AddHour](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#AddHour) -- [AddMinute](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#AddMinute) -- [BeginOfMinute](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#BeginOfMinute) -- [BeginOfHour](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#BeginOfHour) -- [BeginOfDay](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#BeginOfDay) -- [BeginOfWeek](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#BeginOfWeek) -- [BeginOfMonth](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#BeginOfMonth) -- [BeginOfYear](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#BeginOfYear) -- [EndOfMinute](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#EndOfMinute) -- [EndOfHour](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#EndOfHour) -- [EndOfDay](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#EndOfDay) -- [EndOfWeek](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#EndOfWeek) -- [EndOfMonth](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#EndOfMonth) -- [EndOfYear](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#EndOfYear) -- [GetNowDate](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#GetNowDate) -- [GetNowTime](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#GetNowTime) -- [GetNowDateTime](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#GetNowDateTime) -- [GetZeroHourTimestamp](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#GetZeroHourTimestamp) -- [GetNightTimestamp](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#GetNightTimestamp) -- [FormatTimeToStr](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#FormatTimeToStr) -- [FormatStrToTime](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#FormatStrToTime) -- [NewUnix](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#NewUnix) -- [NewUnixNow](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#NewUnixNow) -- [NewFormat](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#NewFormat) -- [NewISO8601](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#NewISO8601) -- [ToUnix](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#ToUnix) -- [ToFormat](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#ToFormat) -- [ToFormatForTpl](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#ToFormatForTpl) -- [ToIso8601](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#ToIso8601) -### 4. fileutil包支持文件基本操作。 + +- [AddDay](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#AddDay) +- [AddHour](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#AddHour) +- [AddMinute](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#AddMinute) +- [BeginOfMinute](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#BeginOfMinute) +- [BeginOfHour](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#BeginOfHour) +- [BeginOfDay](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#BeginOfDay) +- [BeginOfWeek](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#BeginOfWeek) +- [BeginOfMonth](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#BeginOfMonth) +- [BeginOfYear](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#BeginOfYear) +- [EndOfMinute](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#EndOfMinute) +- [EndOfHour](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#EndOfHour) +- [EndOfDay](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#EndOfDay) +- [EndOfWeek](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#EndOfWeek) +- [EndOfMonth](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#EndOfMonth) +- [EndOfYear](https://github.com/duke-git/lancet/blob/v1/docs/datetime.md#EndOfYear) +- [GetNowDate](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#GetNowDate) +- [GetNowTime](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#GetNowTime) +- [GetNowDateTime](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#GetNowDateTime) +- [GetZeroHourTimestamp](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#GetZeroHourTimestamp) +- [GetNightTimestamp](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#GetNightTimestamp) +- [FormatTimeToStr](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#FormatTimeToStr) +- [FormatStrToTime](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#FormatStrToTime) +- [NewUnix](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#NewUnix) +- [NewUnixNow](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#NewUnixNow) +- [NewFormat](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#NewFormat) +- [NewISO8601](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#NewISO8601) +- [ToUnix](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#ToUnix) +- [ToFormat](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#ToFormat) +- [ToFormatForTpl](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#ToFormatForTpl) +- [ToIso8601](https://github.com/duke-git/lancet/blob/v1/docs/datetime_zh-CN.md#ToIso8601) + +### 4. fileutil 包支持文件基本操作。 ```go import "github.com/duke-git/lancet/fileutil" @@ -166,159 +171,169 @@ import "github.com/duke-git/lancet/fileutil" #### 函数列表: -- [ClearFile](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#ClearFile) -- [CreateFile](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#CreateFile) -- [CreateDir](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#CreateDir) -- [CopyFile](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#CopyFile) -- [FileMode](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#FileMode) -- [MiMeType](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#MiMeType) -- [IsExist](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#IsExist) -- [IsLink](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#IsLink) -- [IsDir](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#IsDir) -- [ListFileNames](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#ListFileNames) -- [RemoveFile](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#RemoveFile) -- [ReadFileToString](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#ReadFileToString) -- [ReadFileByLine](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#ReadFileByLine) -- [Zip](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#Zip) -- [UnZip](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#UnZip) +- [ClearFile](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#ClearFile) +- [CreateFile](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#CreateFile) +- [CreateDir](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#CreateDir) +- [CopyFile](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#CopyFile) +- [FileMode](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#FileMode) +- [MiMeType](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#MiMeType) +- [IsExist](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#IsExist) +- [IsLink](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#IsLink) +- [IsDir](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#IsDir) +- [ListFileNames](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#ListFileNames) +- [RemoveFile](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#RemoveFile) +- [ReadFileToString](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#ReadFileToString) +- [ReadFileByLine](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#ReadFileByLine) +- [Zip](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#Zip) +- [UnZip](https://github.com/duke-git/lancet/blob/v1/docs/fileutil_zh-CN.md#UnZip) -### 5. formatter格式化器包含一些数据格式化处理方法。 +### 5. formatter 格式化器包含一些数据格式化处理方法。 ```go import "github.com/duke-git/lancet/formatter" ``` + #### 函数列表: -- [Comma](https://github.com/duke-git/lancet/blob/v1/docs/formatter_zh-CN.md#Comma) +- [Comma](https://github.com/duke-git/lancet/blob/v1/docs/formatter_zh-CN.md#Comma) -### function函数包控制函数执行流程,包含部分函数式编程。 +### function 函数包控制函数执行流程,包含部分函数式编程。 ```go import "github.com/duke-git/lancet/function" ``` #### 函数列表: -- [After](https://github.com/duke-git/lancet/blob/v1/docs/function_zh-CN.md#After) -- [Before](https://github.com/duke-git/lancet/blob/v1/docs/function_zh-CN.md#Before) -- [Curry](https://github.com/duke-git/lancet/blob/v1/docs/function_zh-CN.md#Curry) -- [Compose](https://github.com/duke-git/lancet/blob/v1/docs/function_zh-CN.md#Compose) -- [Debounced](https://github.com/duke-git/lancet/blob/v1/docs/function_zh-CN.md#Debounced) -- [Delay](https://github.com/duke-git/lancet/blob/v1/docs/function_zh-CN.md#Delay) -- [Watcher](https://github.com/duke-git/lancet/blob/v1/docs/function_zh-CN.md#Watcher) -### 6. mathutil包实现了一些数学计算的函数。 +- [After](https://github.com/duke-git/lancet/blob/v1/docs/function_zh-CN.md#After) +- [Before](https://github.com/duke-git/lancet/blob/v1/docs/function_zh-CN.md#Before) +- [Curry](https://github.com/duke-git/lancet/blob/v1/docs/function_zh-CN.md#Curry) +- [Compose](https://github.com/duke-git/lancet/blob/v1/docs/function_zh-CN.md#Compose) +- [Debounced](https://github.com/duke-git/lancet/blob/v1/docs/function_zh-CN.md#Debounced) +- [Delay](https://github.com/duke-git/lancet/blob/v1/docs/function_zh-CN.md#Delay) +- [Watcher](https://github.com/duke-git/lancet/blob/v1/docs/function_zh-CN.md#Watcher) + +### 6. mathutil 包实现了一些数学计算的函数。 ```go import "github.com/duke-git/lancet/mathutil" ``` #### Function list: -- [Exponent](https://github.com/duke-git/lancet/blob/v1/docs/mathutil_zh-CN.md#Exponent) -- [Fibonacci](https://github.com/duke-git/lancet/blob/v1/docs/mathutil_zh-CN.md#Fibonacci) -- [Factorial](https://github.com/duke-git/lancet/blob/v1/docs/mathutil_zh-CN.md#Factorial) -- [Percent](https://github.com/duke-git/lancet/blob/v1/docs/mathutil_zh-CN.md#Percent) -- [RoundToFloat](https://github.com/duke-git/lancet/blob/v1/docs/mathutil_zh-CN.md#RoundToFloat) -- [RoundToString](https://github.com/duke-git/lancet/blob/v1/docs/mathutil_zh-CN.md#RoundToString) -- [TruncRound](https://github.com/duke-git/lancet/blob/v1/docs/mathutil_zh-CN.md#TruncRound) -### 7. netutil网络包支持获取ip地址,发送http请求。 +- [Exponent](https://github.com/duke-git/lancet/blob/v1/docs/mathutil_zh-CN.md#Exponent) +- [Fibonacci](https://github.com/duke-git/lancet/blob/v1/docs/mathutil_zh-CN.md#Fibonacci) +- [Factorial](https://github.com/duke-git/lancet/blob/v1/docs/mathutil_zh-CN.md#Factorial) +- [Percent](https://github.com/duke-git/lancet/blob/v1/docs/mathutil_zh-CN.md#Percent) +- [RoundToFloat](https://github.com/duke-git/lancet/blob/v1/docs/mathutil_zh-CN.md#RoundToFloat) +- [RoundToString](https://github.com/duke-git/lancet/blob/v1/docs/mathutil_zh-CN.md#RoundToString) +- [TruncRound](https://github.com/duke-git/lancet/blob/v1/docs/mathutil_zh-CN.md#TruncRound) + +### 7. netutil 网络包支持获取 ip 地址,发送 http 请求。 ```go import "github.com/duke-git/lancet/netutil" ``` #### 函数列表: -- [ConvertMapToQueryString](https://github.com/duke-git/lancet/blob/v1/docs/netutil_zh-CN.md#ConvertMapToQueryString) -- [EncodeUrl](https://github.com/duke-git/lancet/blob/v1/docs/netutil_zh-CN.md#EncodeUrl) -- [GetInternalIp](https://github.com/duke-git/lancet/blob/v1/docs/netutil_zh-CN.md#GetInternalIp) -- [GetIps](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#GetIps) -- [GetMacAddrs](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#GetMacAddrs) -- [GetPublicIpInfo](https://github.com/duke-git/lancet/blob/v1/docs/netutil_zh-CN.md#GetPublicIpInfo) -- [GetRequestPublicIp](https://github.com/duke-git/lancet/blob/v1/docs/netutil_zh-CN.md#GetRequestPublicIp) -- [IsPublicIP](https://github.com/duke-git/lancet/blob/v1/docs/netutil_zh-CN.md#IsPublicIP) -- [IsInternalIP](https://github.com/duke-git/lancet/blob/v1/docs/netutil_zh-CN.md#IsInternalIP) -- [HttpGet](https://github.com/duke-git/lancet/blob/v1/docs/netutil_zh-CN.md#HttpGet) -- [HttpDelete](https://github.com/duke-git/lancet/blob/v1/docs/netutil_zh-CN.md#HttpDelete) -- [HttpPost](https://github.com/duke-git/lancet/blob/v1/docs/netutil_zh-CN.md#HttpPost) -- [HttpPut](https://github.com/duke-git/lancet/blob/v1/docs/netutil_zh-CN.md#HttpPut) -- [HttpPatch](https://github.com/duke-git/lancet/blob/v1/docs/netutil_zh-CN.md#HttpPatch) -- [ParseHttpResponse](https://github.com/duke-git/lancet/blob/v1/docs/netutil_zh-CN.md#ParseHttpResponse) -### 8. random随机数生成器包,可以生成随机[]bytes, int, string。 +- [ConvertMapToQueryString](https://github.com/duke-git/lancet/blob/v1/docs/netutil_zh-CN.md#ConvertMapToQueryString) +- [EncodeUrl](https://github.com/duke-git/lancet/blob/v1/docs/netutil_zh-CN.md#EncodeUrl) +- [GetInternalIp](https://github.com/duke-git/lancet/blob/v1/docs/netutil_zh-CN.md#GetInternalIp) +- [GetIps](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#GetIps) +- [GetMacAddrs](https://github.com/duke-git/lancet/blob/v1/docs/netutil.md#GetMacAddrs) +- [GetPublicIpInfo](https://github.com/duke-git/lancet/blob/v1/docs/netutil_zh-CN.md#GetPublicIpInfo) +- [GetRequestPublicIp](https://github.com/duke-git/lancet/blob/v1/docs/netutil_zh-CN.md#GetRequestPublicIp) +- [IsPublicIP](https://github.com/duke-git/lancet/blob/v1/docs/netutil_zh-CN.md#IsPublicIP) +- [IsInternalIP](https://github.com/duke-git/lancet/blob/v1/docs/netutil_zh-CN.md#IsInternalIP) +- [HttpGet](https://github.com/duke-git/lancet/blob/v1/docs/netutil_zh-CN.md#HttpGet) +- [HttpDelete](https://github.com/duke-git/lancet/blob/v1/docs/netutil_zh-CN.md#HttpDelete) +- [HttpPost](https://github.com/duke-git/lancet/blob/v1/docs/netutil_zh-CN.md#HttpPost) +- [HttpPut](https://github.com/duke-git/lancet/blob/v1/docs/netutil_zh-CN.md#HttpPut) +- [HttpPatch](https://github.com/duke-git/lancet/blob/v1/docs/netutil_zh-CN.md#HttpPatch) +- [ParseHttpResponse](https://github.com/duke-git/lancet/blob/v1/docs/netutil_zh-CN.md#ParseHttpResponse) + +### 8. random 随机数生成器包,可以生成随机[]bytes, int, string。 ```go import "github.com/duke-git/lancet/random" ``` #### 函数列表: -- [RandBytes](https://github.com/duke-git/lancet/blob/v1/docs/random_zh-CN.md#RandBytes) -- [RandInt](https://github.com/duke-git/lancet/blob/v1/docs/random_zh-CN.md#RandInt) -- [RandString](https://github.com/duke-git/lancet/blob/v1/docs/random_zh-CN.md#RandString) -- [UUIdV4](https://github.com/duke-git/lancet/blob/v1/docs/random.md#UUIdV4) -### 9. retry重试执行函数直到函数运行成功或被context cancel。 + +- [RandBytes](https://github.com/duke-git/lancet/blob/v1/docs/random_zh-CN.md#RandBytes) +- [RandInt](https://github.com/duke-git/lancet/blob/v1/docs/random_zh-CN.md#RandInt) +- [RandString](https://github.com/duke-git/lancet/blob/v1/docs/random_zh-CN.md#RandString) +- [RandUpper](https://github.com/duke-git/lancet/blob/v1/docs/random_zh-CN.md#RandUpper) +- [RandLower](https://github.com/duke-git/lancet/blob/v1/docs/random_zh-CN.md#RandLower) +- [RandNumeral](https://github.com/duke-git/lancet/blob/v1/docs/random_zh-CN.md#RandNumeral) +- [RandNumeralOrLetter](https://github.com/duke-git/lancet/blob/v1/docs/random_zh-CN.md#RandNumeralOrLetter) +- [UUIdV4](https://github.com/duke-git/lancet/blob/v1/docs/random.md#UUIdV4) + +### 9. retry 重试执行函数直到函数运行成功或被 context cancel。 ```go import "github.com/duke-git/lancet/retry" ``` #### 函数列表: -- [Context](https://github.com/duke-git/lancet/blob/v1/docs/retry_zh-CN.md#Context) -- [Retry](https://github.com/duke-git/lancet/blob/v1/docs/retry_zh-CN.md#Retry) -- [RetryFunc](https://github.com/duke-git/lancet/blob/v1/docs/retry_zh-CN.md#RetryFunc) -- [RetryDuration](https://github.com/duke-git/lancet/blob/v1/docs/retry_zh-CN.md#RetryDuration) -- [RetryTimes](https://github.com/duke-git/lancet/blob/v1/docs/retry_zh-CN.md#RetryTimes) +- [Context](https://github.com/duke-git/lancet/blob/v1/docs/retry_zh-CN.md#Context) +- [Retry](https://github.com/duke-git/lancet/blob/v1/docs/retry_zh-CN.md#Retry) +- [RetryFunc](https://github.com/duke-git/lancet/blob/v1/docs/retry_zh-CN.md#RetryFunc) +- [RetryDuration](https://github.com/duke-git/lancet/blob/v1/docs/retry_zh-CN.md#RetryDuration) +- [RetryTimes](https://github.com/duke-git/lancet/blob/v1/docs/retry_zh-CN.md#RetryTimes) -### 10. slice包包含操作切片的方法集合。 +### 10. slice 包包含操作切片的方法集合。 ```go import "github.com/duke-git/lancet/slice" ``` #### 函数列表: -- [AppendIfAbsent](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#AppendIfAbsent) -- [Contain](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Contain) -- [ContainSubSlice](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#ContainSubSlice) -- [Chunk](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Chunk) -- [Compact](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Compact) -- [Concat](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Concat) -- [Count](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Count) -- [Difference](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Difference) -- [DifferenceBy](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#DifferenceBy) -- [DeleteByIndex](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#DeleteByIndex) -- [Drop](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Drop) -- [Every](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Every) -- [Equal](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Equal) -- [EqualWith](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#EqualWith) -- [Filter](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Filter) -- [Find](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Find) -- [FindLast](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#FindLast) -- [FlattenDeep](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#FlattenDeep) -- [ForEach](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#ForEach) -- [GroupBy](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#GroupBy) -- [IntSlice](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#IntSlice) -- [IndexOf](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#IndexOf) -- [LastIndexOf](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#LastIndexOf) -- [InterfaceSlice](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#InterfaceSlice) -- [Intersection](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Intersection) -- [InsertByIndex](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#InsertByIndex) -- [Map](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Map) -- [ReverseSlice](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#ReverseSlice) -- [Reduce](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Reduce) -- [Shuffle](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Shuffle) -- [SortByField](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#SortByField) -- [Some](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Some) -- [StringSlice](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#StringSlice) -- [ToSlice](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#ToSlice) -- [ToSlicePointer](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#ToSlice) -- [Unique](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Unique) -- [UniqueBy](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#UniqueBy) -- [Union](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Union) -- [UpdateByIndex](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#UpdateByIndex) -- [Without](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Without) +- [AppendIfAbsent](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#AppendIfAbsent) +- [Contain](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Contain) +- [ContainSubSlice](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#ContainSubSlice) +- [Chunk](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Chunk) +- [Compact](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Compact) +- [Concat](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Concat) +- [Count](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Count) +- [Difference](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Difference) +- [DifferenceBy](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#DifferenceBy) +- [DeleteByIndex](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#DeleteByIndex) +- [Drop](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Drop) +- [Every](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Every) +- [Equal](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Equal) +- [EqualWith](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#EqualWith) +- [Filter](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Filter) +- [Find](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Find) +- [FindLast](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#FindLast) +- [FlattenDeep](https://github.com/duke-git/lancet/blob/v1/docs/slice.md#FlattenDeep) +- [ForEach](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#ForEach) +- [GroupBy](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#GroupBy) +- [IntSlice](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#IntSlice) +- [IndexOf](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#IndexOf) +- [LastIndexOf](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#LastIndexOf) +- [InterfaceSlice](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#InterfaceSlice) +- [Intersection](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Intersection) +- [InsertByIndex](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#InsertByIndex) +- [Map](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Map) +- [ReverseSlice](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#ReverseSlice) +- [Reduce](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Reduce) +- [Shuffle](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Shuffle) +- [SortByField](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#SortByField) +- [Some](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Some) +- [StringSlice](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#StringSlice) +- [ToSlice](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#ToSlice) +- [ToSlicePointer](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#ToSlice) +- [Unique](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Unique) +- [UniqueBy](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#UniqueBy) +- [Union](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Union) +- [UpdateByIndex](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#UpdateByIndex) +- [Without](https://github.com/duke-git/lancet/blob/v1/docs/slice_zh-CN.md#Without) -### 12. strutil包含处理字符串的相关函数。 +### 12. strutil 包含处理字符串的相关函数。 ```go import "github.com/duke-git/lancet/strutil" @@ -326,84 +341,84 @@ import "github.com/duke-git/lancet/strutil" #### 函数列表: -- [After](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#After) -- [AfterLast](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#AfterLast) -- [Before](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#Before) -- [BeforeLast](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#BeforeLast) -- [CamelCase](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#CamelCase) -- [Capitalize](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#Capitalize) -- [IsString](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#IsString) -- [KebabCase](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#KebabCase) -- [LowerFirst](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#LowerFirst) -- [UpperFirst](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#UpperFirst) -- [PadEnd](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#PadEnd) -- [PadStart](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#PadStart) -- [Reverse](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#Reverse) -- [SnakeCase](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#SnakeCase) -- [SplitEx](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#SplitEx) -- [Wrap](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#Wrap) -- [Unwrap](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#Unwrap) - +- [After](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#After) +- [AfterLast](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#AfterLast) +- [Before](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#Before) +- [BeforeLast](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#BeforeLast) +- [CamelCase](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#CamelCase) +- [Capitalize](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#Capitalize) +- [IsString](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#IsString) +- [KebabCase](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#KebabCase) +- [LowerFirst](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#LowerFirst) +- [UpperFirst](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#UpperFirst) +- [PadEnd](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#PadEnd) +- [PadStart](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#PadStart) +- [Reverse](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#Reverse) +- [SnakeCase](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#SnakeCase) +- [SplitEx](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#SplitEx) +- [Wrap](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#Wrap) +- [Unwrap](https://github.com/duke-git/lancet/blob/v1/docs/strutil_zh-CN.md#Unwrap) -### 13. system包含os, runtime, shell command相关函数。 +### 13. system 包含 os, runtime, shell command 相关函数。 ```go import "github.com/duke-git/lancet/system" ``` #### 函数列表: -- [IsWindows](https://github.com/duke-git/lancet/blob/v1/docs/system_zh-CN.md#IsWindows) -- [IsLinux](https://github.com/duke-git/lancet/blob/v1/docs/system_zh-CN.md#IsLinux) -- [IsMac](https://github.com/duke-git/lancet/blob/v1/docs/system_zh-CN.md#IsMac) -- [GetOsEnv](https://github.com/duke-git/lancet/blob/v1/docs/system_zh-CN.md#GetOsEnv) -- [SetOsEnv](https://github.com/duke-git/lancet/blob/v1/docs/system_zh-CN.md#SetOsEnv) -- [RemoveOsEnv](https://github.com/duke-git/lancet/blob/v1/docs/system_zh-CN.md#RemoveOsEnv) -- [CompareOsEnv](https://github.com/duke-git/lancet/blob/v1/docs/system_zh-CN.md#CompareOsEnv) -- [ExecCommand](https://github.com/duke-git/lancet/blob/v1/docs/system_zh-CN.md#ExecCommand) -- [GetOsBits](https://github.com/duke-git/lancet/blob/v1/docs/system_zh-CN.md#GetOsBits) -### 14. validator验证器包,包含常用字符串格式验证函数。 +- [IsWindows](https://github.com/duke-git/lancet/blob/v1/docs/system_zh-CN.md#IsWindows) +- [IsLinux](https://github.com/duke-git/lancet/blob/v1/docs/system_zh-CN.md#IsLinux) +- [IsMac](https://github.com/duke-git/lancet/blob/v1/docs/system_zh-CN.md#IsMac) +- [GetOsEnv](https://github.com/duke-git/lancet/blob/v1/docs/system_zh-CN.md#GetOsEnv) +- [SetOsEnv](https://github.com/duke-git/lancet/blob/v1/docs/system_zh-CN.md#SetOsEnv) +- [RemoveOsEnv](https://github.com/duke-git/lancet/blob/v1/docs/system_zh-CN.md#RemoveOsEnv) +- [CompareOsEnv](https://github.com/duke-git/lancet/blob/v1/docs/system_zh-CN.md#CompareOsEnv) +- [ExecCommand](https://github.com/duke-git/lancet/blob/v1/docs/system_zh-CN.md#ExecCommand) +- [GetOsBits](https://github.com/duke-git/lancet/blob/v1/docs/system_zh-CN.md#GetOsBits) + +### 14. validator 验证器包,包含常用字符串格式验证函数。 ```go import "github.com/duke-git/lancet/validator" ``` + #### 函数列表: -- [ContainChinese](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#ContainChinese) -- [ContainLetter](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#ContainLetter) -- [ContainLower](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#ContainLower) -- [ContainUpper](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#ContainUpper) -- [IsAlpha](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsAlpha) -- [IsAllUpper](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsAllUpper) -- [IsAllLower](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsAllLower) -- [IsBase64](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsBase64) -- [IsChineseMobile](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsChineseMobile) -- [IsChineseIdNum](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsChineseIdNum) -- [IsChinesePhone](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsChinesePhone) -- [IsCreditCard](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsCreditCard) -- [IsDns](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsDns) -- [IsEmail](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsEmail) -- [IsEmptyString](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsEmptyString) -- [IsFloatStr](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsFloatStr) -- [IsNumberStr](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsNumberStr) -- [IsJSON](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsJSON) -- [IsRegexMatch](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsRegexMatch) -- [IsIntStr](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsIntStr) -- [IsIp](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsIp) -- [IsIpV4](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsIpV4) -- [IsIpV6](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsIpV6) -- [IsStrongPassword](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsStrongPassword) -- [IsUrl](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsUrl) -- [IsWeakPassword](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsWeakPassword) -- [IsZeroValue](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsZeroValue) - +- [ContainChinese](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#ContainChinese) +- [ContainLetter](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#ContainLetter) +- [ContainLower](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#ContainLower) +- [ContainUpper](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#ContainUpper) +- [IsAlpha](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsAlpha) +- [IsAllUpper](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsAllUpper) +- [IsAllLower](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsAllLower) +- [IsBase64](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsBase64) +- [IsChineseMobile](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsChineseMobile) +- [IsChineseIdNum](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsChineseIdNum) +- [IsChinesePhone](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsChinesePhone) +- [IsCreditCard](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsCreditCard) +- [IsDns](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsDns) +- [IsEmail](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsEmail) +- [IsEmptyString](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsEmptyString) +- [IsFloatStr](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsFloatStr) +- [IsNumberStr](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsNumberStr) +- [IsJSON](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsJSON) +- [IsRegexMatch](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsRegexMatch) +- [IsIntStr](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsIntStr) +- [IsIp](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsIp) +- [IsIpV4](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsIpV4) +- [IsIpV6](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsIpV6) +- [IsStrongPassword](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsStrongPassword) +- [IsUrl](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsUrl) +- [IsWeakPassword](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsWeakPassword) +- [IsZeroValue](https://github.com/duke-git/lancet/blob/v1/docs/validator_zh-CN.md#IsZeroValue) ## 如何贡献代码 -非常感激任何的代码提交以使lancet的功能越来越强大。创建pull request时请遵守以下规则。 +非常感激任何的代码提交以使 lancet 的功能越来越强大。创建 pull request 时请遵守以下规则。 -1. Fork lancet仓库。 +1. Fork lancet 仓库。 2. 创建自己的特性分支。 3. 提交变更。 -4. Push分支。 -5. 创建新的pull request。 \ No newline at end of file +4. Push 分支。 +5. 创建新的 pull request。