Documentation ¶
Overview ¶
*
- @copyright www.ruomm.com
- @author 牛牛-wanruome@126.com
- @create 2024/5/14 10:11
- @version 1.0
*
- @copyright www.ruomm.com
- @author 牛牛-wanruome@126.com
- @create 2024/4/18 09:59
- @version 1.0
*
- @copyright 像衍科技-idr.ai
- @author 牛牛-研发部-www.ruomm.com
- @create 2024/1/24 11:23
- @version 1.0
*
- @copyright 像衍科技-idr.ai
- @author 牛牛-研发部-www.ruomm.com
- @create 2024/1/24 13:13
- @version 1.0
Index ¶
- Constants
- func ConcatDirPath(filePath string, subPath string, separatorRevise bool) string
- func ConcatFilePath(filePath string, fileName string, separatorRevise bool) string
- func CopyFile(pathSrc string, pathDest string) error
- func FieldNameToSimply(fieldName string) string
- func FillStringLeft(input string, padding string, len_total int) string
- func FillStringRight(input string, padding string, len_total int) string
- func FirstIndexOfFileSeparator(filePath string) int
- func Float64Format(floatVal float64, prec int) float64
- func Float64ToStr(floatVal float64, prec int) string
- func GetAbsDir(relativePath string) string
- func GetCurrentPath() string
- func GetDayCountByMonth(year int, month int) int
- func GetFileExtension(filePath string) string
- func GetFileName(filePath string) string
- func GetFileNameWithoutExtension(filePath string) string
- func GetLenForAny(i interface{}) int
- func GetMd5(data string) string
- func GetMd5WithSlat(data, slat string) string
- func Int64ToStr(i int64) string
- func Int64ToStrFill(i int64, len_total int) string
- func IsAbsDir(path string) bool
- func IsAllChinese(str string) bool
- func IsAllChineseChar(str string) bool
- func IsChinese(str string) bool
- func IsChineseChar(str string) bool
- func IsEndWithFileSeparator(filePath string) bool
- func IsFileExit(file_path string) (bool, error)
- func IsFileExitWithErr(file_path string) (bool, error)
- func IsLastDayInMonth(year int, month int, day int) bool
- func IsLeapyear(year int) bool
- func IsNil(i interface{}) bool
- func IsRegexMatch(reg_pattern string, val string) bool
- func IsStartWithFileSeparator(filePath string) bool
- func JsonFormatByString(v any) (string, error)
- func JsonParseByString(str string, v any) error
- func LastIndexOfFileSeparator(filePath string) int
- func MatchStringCommon(pattern string, s string) bool
- func MatchStringEmptyPatternPass(pattern string, s string) bool
- func MkdirAll(file_path string) (bool, error)
- func ParseFileSeparator(filePath string) string
- func ParseToSubTag(tag string) []string
- func ParseUrlWithContextPath(contextPath string, elem string) (string, error)
- func QueryDayParseEnd(queryEnd string) string
- func QueryDayParseStart(queryStart string) string
- func ReadFile(path string) (string, error)
- func ReadFileBuffer(path string) (string, error)
- func ServerTrace(tracePort int)
- func SliceContains(srcSlice interface{}, values ...interface{}) bool
- func SliceContainsByKey(srcSlice interface{}, key string, values ...interface{}) bool
- func SliceDuplicates(srcSlice interface{}) bool
- func SliceDuplicatesByKey(srcSlice interface{}, key string) bool
- func SliceFindFieldValue(srcSlice interface{}, key string, destKey string, values ...interface{}) interface{}
- func SliceFindValue(srcSlice interface{}, key string, values ...interface{}) interface{}
- func SliceIndexOf(srcSlice interface{}, values ...interface{}) int
- func SliceIndexOfByKey(srcSlice interface{}, key string, values ...interface{}) int
- func SliceOnlyContains(srcSlice interface{}, values ...interface{}) bool
- func SliceOnlyContainsByKey(srcSlice interface{}, key string, values ...interface{}) bool
- func StoreSizeFormat(byteSize int64, prec int) string
- func StoreSizeParse(bytesizeStr string) (int64, error)
- func StrToFloat64(str string) float64
- func StrToInt64(str string) int64
- func StrToUInt64(str string) uint64
- func StringToSlice(str string, sep string, emptyRetain bool) []string
- func TagIsValid(s string) bool
- func TimeAfterCurrent(timeLayout string, timeStr string) (bool, error)
- func TimeBeforceCurrent(timeLayout string, timeStr string) (bool, error)
- func TimeCurrentDay(currentDay *time.Time) string
- func TimeCurrentMonth(currentDay *time.Time) string
- func TimeFormatByMilliSeconds(timeLayout string, msec int64) string
- func TimeFormatByString(timeLayout string, t *time.Time) string
- func TimeNextDay(currentDay *time.Time) string
- func TimeNextDayByString(dayString string) string
- func TimeNextMonth(currentDay *time.Time) string
- func TimeNextMonthByString(monthString string) string
- func TimeNumberFormat(timeNumberValue int64, prec int, secondMode bool) string
- func TimeNumberParse(timenumStr string, secondMode bool) (int64, error)
- func TimeOffsetDay(currentDay *time.Time, offsetDay int) string
- func TimeOffsetDayByString(dayString string, offsetDay int) string
- func TimeOffsetMonth(currentDay *time.Time, offsetMonth int) string
- func TimeOffsetMonthByString(monthString string, offsetMonth int) string
- func TimeParseByString(timeLayout string, sTime string) (*time.Time, error)
- func TimePreDay(currentDay *time.Time) string
- func TimePreDayByString(dayString string) string
- func TimePreMonth(currentDay *time.Time) string
- func TimePreMonthByString(monthString string) string
- func TimeToFileName(pTime *time.Time, filehead string, filetype string, fileTimeLayout string) string
- func TimeToYearMonthDay(dayString string) (int64, int64, int64)
- func TimeValidDayString(dayString string) bool
- func TimeValidMonthString(monthString string) bool
- func ToSnakeCase(str string) string
- func ToTimeLocation() *time.Location
- func ToTimeLocationPattern(timezoneValue string, timezoneOffset int) *time.Location
- func Uint64ToStr(i uint64) string
- func Uint64ToStrFill(i uint64, len_total int) string
- func WriteFile(path string, content string) error
- func WriteFileBuffer(path string, content string) error
- type TagOptions
- type TokenHelper
Constants ¶
const ( TIME_PATTERN_STANDARD string = "2006-01-02 15:04:05" TIME_PATTERN_STANDARD_DAY string = "2006-01-02" TIME_PATTERN_STANDARD_MONTH string = "2006-01" TIME_PATTERN_STANDARD_MILLS string = "2006-01-02 15:04:05.999" TIME_PATTERN_NOSPACE string = "20060102150405" TIME_PATTERN_NOSPACE_DAY string = "20060102" TIME_PATTERN_NOSPACE_MONTH string = "200601" TIME_PATTERN_NOSPACE_MILLS string = "20060102150405999" )
Variables ¶
This section is empty.
Functions ¶
func ConcatDirPath ¶
*
- 拼接2个目录完整目录路径 *
- @param filePath 目录路径
- @param subPath 次级目录路径
- @param separatorRevise 是否修订名称中的文件分隔路径
- @return 完整文件路径
func ConcatFilePath ¶
*
- 拼接2个目录或1个目录1个文件为完整文件路径 *
- @param filePath 目录路径
- @param fileName 文件名称或目录路径
- @param separatorRevise 是否修订名称中的文件分隔路径
- @return 完整文件路径
func FirstIndexOfFileSeparator ¶
*
- 查找文件分割符号第一个的位置 *
- @param filePath 文件路径
- @return 返回分割符号第一个的位置位置,空返回-99,没有返回-1,
func Float64Format ¶ added in v0.3.0
func Float64ToStr ¶ added in v0.3.0
func GetDayCountByMonth ¶ added in v0.7.2
获取一个月有多少天
func GetFileExtension ¶ added in v0.8.6
*
- 获取文件的后缀从路径 *
- <pre>
- getFileExtension(null) = ""
- getFileExtension("") = ""
- getFileExtension(" ") = " "
- getFileExtension("a.mp3") = "mp3"
- getFileExtension("a.b.rmvb") = "rmvb"
- getFileExtension("abc") = ""
- getFileExtension("c:\\") = ""
- getFileExtension("c:\\a") = ""
- getFileExtension("c:\\a.b") = "b"
- getFileExtension("c:a.txt\\a") = ""
- getFileExtension("/home/admin") = ""
- getFileExtension("/home/admin/a.txt/b") = ""
- getFileExtension("/home/admin/a.txt/b.mp3") = "mp3"
- </pre> *
- @param filePath
- @return
func GetFileName ¶ added in v0.8.6
*
- 从路径获取文件名,包括后缀 *
- <pre>
- getFileName(null) = null
- getFileName("") = ""
- getFileName(" ") = " "
- getFileName("a.mp3") = "a.mp3"
- getFileName("a.b.rmvb") = "a.b.rmvb"
- getFileName("abc") = "abc"
- getFileName("c:\\") = ""
- getFileName("c:\\a") = "a"
- getFileName("c:\\a.b") = "a.b"
- getFileName("c:a.txt\\a") = "a"
- getFileName("/home/admin") = "admin"
- getFileName("/home/admin/a.txt/b.mp3") = "b.mp3"
- </pre> *
- @param filePath 文件路径 -
- @return 从路径文件名,包括后缀
func GetFileNameWithoutExtension ¶ added in v0.8.6
*
- 从路径获取文件名,不包括后缀 *
- <pre>
- getFileNameWithoutExtension(null) = null
- getFileNameWithoutExtension("") = ""
- getFileNameWithoutExtension(" ") = " "
- getFileNameWithoutExtension("abc") = "abc"
- getFileNameWithoutExtension("a.mp3") = "a"
- getFileNameWithoutExtension("a.b.rmvb") = "a.b"
- getFileNameWithoutExtension("c:\\") = ""
- getFileNameWithoutExtension("c:\\a") = "a"
- getFileNameWithoutExtension("c:\\a.b") = "a"
- getFileNameWithoutExtension("c:a.txt\\a") = "a"
- getFileNameWithoutExtension("/home/admin") = "admin"
- getFileNameWithoutExtension("/home/admin/a.txt/b.mp3") = "b"
- </pre> *
- @param filePath 文件路径 -
- @return 从路径文件名,不包括后缀
- @see
func GetLenForAny ¶ added in v0.3.5
func GetLenForAny(i interface{}) int
func GetMd5WithSlat ¶
func Int64ToStr ¶
func Int64ToStrFill ¶ added in v0.7.5
func IsEndWithFileSeparator ¶
*
- 文件路径是否以文件夹连接符号(File.separator)结尾 *
- @param filePath 文件路径
- @return 文件路径是否以文件夹连接符号(File.separator)结尾
func IsFileExit ¶
func IsFileExitWithErr ¶ added in v0.2.4
func IsLastDayInMonth ¶ added in v0.7.2
判断是否一个月的最右一天
func IsRegexMatch ¶ added in v1.2.1
func IsStartWithFileSeparator ¶
*
- 文件路径是否以文件夹连接符号(File.separator)开始 *
- @param filePath 文件路径
- @return 文件路径是否以文件夹连接符号(File.separator)开始
func JsonFormatByString ¶ added in v0.1.3
func JsonParseByString ¶ added in v0.1.3
func LastIndexOfFileSeparator ¶
*
- 查找文件分割符号最后的位置 *
- @param filePath 文件路径
- @return 返回分割符号最后的位置,空返回-99,没有返回-1,
func MatchStringCommon ¶ added in v0.1.2
判断字符串是否匹配,支持正则表达式,支持开头结尾*通配符,支持严格匹配
func MatchStringEmptyPatternPass ¶ added in v0.1.5
判断字符串是否匹配,支持正则表达式,支持开头结尾*通配符,支持严格匹配
func ParseFileSeparator ¶
*
- 依据文文件或文件夹路径智能获取文件夹连接符号(File.separator)。 *
- @param filePath 文件或文件夹路径
- @return 文件夹连接符号(File.separator)
func ParseUrlWithContextPath ¶
func QueryDayParseStart ¶ added in v0.8.6
解析查询的开始时间
func ReadFileBuffer ¶
func ServerTrace ¶
func ServerTrace(tracePort int)
func SliceContains ¶ added in v0.9.7
func SliceContains(srcSlice interface{}, values ...interface{}) bool
判断Slice是否含有特定元素
func SliceContainsByKey ¶ added in v0.9.8
判断Slice是否含有特定元素
func SliceDuplicates ¶ added in v0.9.6
func SliceDuplicates(srcSlice interface{}) bool
判断Slice是否含有重复元素
func SliceDuplicatesByKey ¶ added in v0.9.8
判断Slice是否含有重复元素
func SliceFindFieldValue ¶ added in v1.0.7
func SliceFindFieldValue(srcSlice interface{}, key string, destKey string, values ...interface{}) interface{}
获取Slice中的特定元素
func SliceFindValue ¶ added in v1.0.7
func SliceFindValue(srcSlice interface{}, key string, values ...interface{}) interface{}
获取Slice中的特定元素
func SliceIndexOf ¶ added in v1.1.6
func SliceIndexOf(srcSlice interface{}, values ...interface{}) int
判断Slice是否含有特定元素
func SliceIndexOfByKey ¶ added in v1.1.6
判断Slice是否含有特定元素
func SliceOnlyContains ¶ added in v0.9.8
func SliceOnlyContains(srcSlice interface{}, values ...interface{}) bool
判断Slice是否仅仅含有特定元素
func SliceOnlyContainsByKey ¶ added in v0.9.8
判断Slice是否仅仅含有特定元素
func StoreSizeFormat ¶ added in v0.2.0
func StoreSizeParse ¶ added in v0.2.0
func StrToFloat64 ¶ added in v0.3.0
func StrToInt64 ¶
func StrToUInt64 ¶
func StringToSlice ¶ added in v0.9.7
转换string为slice
func TimeFormatByMilliSeconds ¶ added in v0.2.1
格式化时间为字符串
func TimeFormatByString ¶ added in v0.1.3
格式化时间为字符串
func TimeNextDayByString ¶ added in v1.0.5
获取后一天的时间
func TimeNextMonthByString ¶ added in v1.0.5
获取后一月的时间
func TimeNumberFormat ¶ added in v0.1.1
func TimeNumberParse ¶ added in v0.1.1
func TimeOffsetDay ¶ added in v1.0.9
获取间隔特定天数的时间
func TimeOffsetDayByString ¶ added in v1.0.9
获取间隔特定天数的时间
func TimeOffsetMonth ¶ added in v1.0.9
获取间隔特定月数的时间
func TimeOffsetMonthByString ¶ added in v1.0.9
获取间隔特定月数的时间
func TimeParseByString ¶ added in v0.1.3
TimeParseByString 解析字符串为时间
func TimePreMonthByString ¶ added in v1.0.5
获取前一月的时间
func TimeToFileName ¶ added in v0.1.4
func TimeToFileName(pTime *time.Time, filehead string, filetype string, fileTimeLayout string) string
*
- 依据时间生成文件名称
- @param pTime 时间
- @param filehead 文件头
- @param filetype 文件结尾
- @param outTimeFormat SimpleDateFormat的格式,默认yyyyMMdd_HHmmss格式
- @return 生成的文件名称
func TimeToYearMonthDay ¶ added in v1.0.8
func TimeValidDayString ¶ added in v1.0.5
func TimeValidMonthString ¶ added in v1.0.5
func ToTimeLocationPattern ¶
转换时间为特定时区时间
func Uint64ToStr ¶
func Uint64ToStrFill ¶ added in v0.7.5
func WriteFileBuffer ¶
Types ¶
type TagOptions ¶
type TagOptions string
TagOptions is the string following a comma in a struct field's "json" tag, or the empty string. It does not include the leading comma.
func ParseTagToNameOption ¶
func ParseTagToNameOption(tag string) (string, TagOptions)
parseTag splits a struct field's json tag into its name and comma-separated options. 把tag分割为名称和功能
func ParseTagToNameOptionFenHao ¶ added in v0.6.4
func ParseTagToNameOptionFenHao(tag string) (string, TagOptions)
把tag分割为小功能块的子subTag
func (TagOptions) Contains ¶
func (o TagOptions) Contains(optionKey string) bool
Contains reports whether a comma-separated list of options contains a particular substr flag. substr must be surrounded by a string boundary or commas.
func (TagOptions) OptionValue ¶
func (o TagOptions) OptionValue(optionKey string) string
返回一个控制指令的具体值,可以以=:.三种符号分割控制质量和控制值
type TokenHelper ¶
func (*TokenHelper) GenToken ¶
func (t *TokenHelper) GenToken(token_len int) string
func (*TokenHelper) GenTokenDefault ¶
func (t *TokenHelper) GenTokenDefault() string
func (*TokenHelper) GenTokenDefaultNoZeroStart ¶ added in v0.2.5
func (t *TokenHelper) GenTokenDefaultNoZeroStart() string
func (*TokenHelper) GenTokenNoZeroStart ¶ added in v0.2.5
func (t *TokenHelper) GenTokenNoZeroStart(token_len int) string