Documentation ¶
Index ¶
- Constants
- func BytesToString(data *[]byte) string
- func CSTLayoutString() string
- func CSTLayoutStringToUnix(cstLayoutString string) (int64, error)
- func GMTLayoutString() string
- func IncludeLetter(str string) bool
- func Int64ToString(num int64) string
- func IntToString(num int) string
- func IsDigit(str string) bool
- func ParseCSTInLocation(date string) (time.Time, error)
- func ParseGMTInLocation(date string) (time.Time, error)
- func PbTimeToDate(ts *timestamppb.Timestamp) string
- func RFC3339ToCSTLayout(value string) (string, error)
- func RandomString(n int) string
- func StringToBytes(data string) (b []byte)
- func StringToUint64(num string) uint64
- func TimeToDate(time time.Time) string
- func TimeToDateTime(time time.Time) string
- func TimeToPb(time time.Time) *timestamppb.Timestamp
- func Uint64ToString(num uint64) string
Constants ¶
View Source
const ( DateLayout = "2006-01-02" TimeLayout = "15:04:05" CSTLayout = DateLayout + " " + TimeLayout )
Variables ¶
This section is empty.
Functions ¶
func BytesToString ¶
func CSTLayoutString ¶
func CSTLayoutString() string
CSTLayoutString 格式化时间 返回 "2006-01-02 15:04:05" 格式的时间
func CSTLayoutStringToUnix ¶
CSTLayoutStringToUnix 返回 unix 时间戳 2020-01-24 21:11:11 => 1579871471
func GMTLayoutString ¶
func GMTLayoutString() string
GMTLayoutString 格式化时间 返回 "Mon, 02 Jan 2006 15:04:05 GMT" 格式的时间
func IncludeLetter ¶
func Int64ToString ¶
func IntToString ¶
func ParseCSTInLocation ¶
ParseCSTInLocation 格式化时间
func ParseGMTInLocation ¶
ParseGMTInLocation 格式化时间
func PbTimeToDate ¶
func PbTimeToDate(ts *timestamppb.Timestamp) string
PbTimeToDate 将 protobuf 时间转换成 yyyy-mm-dd 格式
func RFC3339ToCSTLayout ¶
RFC3339ToCSTLayout convert rfc3339 value to china standard time layout 2020-11-08T08:18:46+08:00 => 2020-11-08 08:18:46
func RandomString ¶
RandomString 生成随机字符串。参考:https://colobu.com/2018/09/02/generate-random-string-in-Go/
func StringToBytes ¶
func StringToUint64 ¶
func TimeToDateTime ¶
TimeToDateTime 将时间转换为 yyyy-mm-dd HH:ii:ss 格式
func Uint64ToString ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.