util

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Segmenter sego.Segmenter

Functions

func ConvertToPinyin

func ConvertToPinyin(content string) string

func FileExist

func FileExist(path string) bool

func FileExt

func FileExt(fileName string) string

func FileType

func FileType(fileName string) string

FileType return image or file

func GetCurrentTime

func GetCurrentTime() string

GetCurrentTime returns formatted current time.

func GetDateStr

func GetDateStr() string

GetDateStr returns formatted current time with the year, month and day.

func GetIPInfo

func GetIPInfo(clientIP string) string

func GetTimeDay

func GetTimeDay(day int) string

GetTimeDay returns the time after the specified duration(day).

func GetTimeFromTimestamp

func GetTimeFromTimestamp(stamp int64) string

func GetTimeHour

func GetTimeHour(hour int) string

GetTimeHour returns the time after the specified duration(hour).

func GetTimeMinute

func GetTimeMinute(minute int) string

GetTimeMinute returns the time after the specified duration(minute).

func GetTimeMonth

func GetTimeMonth(month int) string

GetTimeMonth returns the time after the specified duration(month).

func GetTimeYear

func GetTimeYear(year int) string

GetTimeYear returns the time after the specified duration(year).

func InitSegmenter

func InitSegmenter()

func IntToString

func IntToString(i int) string

func JsonToStruct

func JsonToStruct(data string, v interface{}) error

func ListFiles

func ListFiles(path string) []string

func LogInfo

func LogInfo(ctx *context.Context, f string, v ...interface{})

func LogWarning

func LogWarning(ctx *context.Context, f string, v ...interface{})

func ParseInt

func ParseInt(s string) int

func ReadLog

func ReadLog() []string

func ReadStringFromPath

func ReadStringFromPath(path string) string

func SplitWords

func SplitWords(str string) []string

SplitWords split string into single words.

func StructToJson

func StructToJson(v interface{}) string

func StructToJsonFormatted

func StructToJsonFormatted(v interface{}) string

func Time2String added in v1.4.0

func Time2String(t time.Time) string

func WriteStringToPath

func WriteStringToPath(s string, path string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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