Documentation ¶
Index ¶
- func Convert2Yaml(c interface{}) (string, error)
- func CreateTime(millis int64) time.Time
- func GetDateString(t time.Time) string
- func GetDay(t time.Time) int
- func GetHour(t time.Time) int
- func GetHumanReadableDuration(start time.Time, end time.Time) string
- func GetLongDateString(t time.Time) string
- func GetLongHumanReadableDuration(start time.Time, end time.Time) string
- func GetLongLongDateString(t time.Time) string
- func GetMillionSecond(t time.Time) int
- func GetMinute(t time.Time) int
- func GetMonth(t time.Time) int
- func GetMyAddress(preferredNetworks ...string) string
- func GetNanosecond(t time.Time) int64
- func GetSecond(t time.Time) int
- func GetShortDateString(t time.Time) string
- func GetTimestamp(t time.Time) int64
- func GetYear(t time.Time) int
- func LimitRange(value interface{}, defaultValue interface{}, rangeValues ...interface{}) interface{}
- func List2Array(ls *list.List) []interface{}
- func ParseHostPortFromConnStr(connStr string) (string, int)
- func ParseYamlFromString(input string, target interface{}) error
- func TOperation(condition bool, trueOperation func() interface{}, ...) interface{}
- func TValue(condition bool, trueValue interface{}, falseValue interface{}) interface{}
- func Try(f func(), catcher func(e interface{}))
- func WalkList(ls *list.List, walker func(item interface{}) bool)
- type IP
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Convert2Yaml ¶ added in v1.0.8
Convert2Yaml 将对象转为yaml文本
func CreateTime ¶
CreateTime returns the local Time corresponding to the given Unix time, sec seconds and nsec nanoseconds since January 1, 1970 UTC. It is valid to pass nsec outside the range [0, 999999999]. Not all sec values have a corresponding time value. One such value is 1<<63-1 (the largest int64 value).
func GetDateString ¶
GetDateString gets short date format like '2018-11-11'.
func GetHumanReadableDuration ¶
GetHumanReadableDuration gets a duration between times and returns format like '01:12:31' (?hour:?minute:?second).
func GetLongDateString ¶
GetLongDateString gets date format like '2018-11-11 12:12:12'.
func GetLongHumanReadableDuration ¶
GetLongHumanReadableDuration gets a duration between times and returns format like '1d 3h 12m 11s' (?day ?hour ?minute ?second).
func GetLongLongDateString ¶
GetLongLongDateString gets short date format like '2018-11-11 12:12:12,233'.
func GetMillionSecond ¶
GetMillionSecond gets millionSecond number.
func GetMyAddress ¶
GetMyAddress get self ip address by preferred interface
func GetNanosecond ¶
GetNanosecond gets current timestamp in Nanosecond.
func GetShortDateString ¶
GetShortDateString gets time format like '12:12:12'.
func GetTimestamp ¶
GetTimestamp gets current timestamp in milliseconds.
func LimitRange ¶
func LimitRange(value interface{}, defaultValue interface{}, rangeValues ...interface{}) interface{}
LimitRange limits a variable's value in a value range. returns defaultValue if the range not provided or the value is not in the range,
func ParseHostPortFromConnStr ¶
ParseHostPortFromConnStr parses host and port from connection string.
func ParseYamlFromString ¶ added in v1.0.8
ParseYamlFromString 从字符串解析yaml为对象
func TOperation ¶
func TOperation(condition bool, trueOperation func() interface{}, falseOperation func() interface{}) interface{}
TOperation simulates ternary operation.