Documentation ¶
Index ¶
- Constants
- func AddPathSeparatorIfAbsent(path string) string
- func CreateDirIfNotExists(dirname string) error
- func CurrentTimeMillis() uint64
- func CurrentTimeMillsWithTicker() uint64
- func CurrentTimeNano() uint64
- func DecrementAndGetInt64(v *int64) int64
- func FileExists(name string) (b bool, err error)
- func FilePosition(file *os.File) (int64, error)
- func Float64Equals(x, y float64) bool
- func FormatDate(tsMillis uint64) string
- func FormatTimeMillis(tsMillis uint64) string
- func IncrementAndGetInt64(v *int64) int64
- func IsBlank(s string) bool
- func NewUuid() string
- func RunWithRecover(f func())
- func StartTimeTicker()
- type AtomicBool
- type SliceHeader
- type StringHeader
Constants ¶
View Source
const ( TimeFormat = "2006-01-02 15:04:05" DateFormat = "2006-01-02" UnixTimeUnitOffset = uint64(time.Millisecond / time.Nanosecond) )
Variables ¶
This section is empty.
Functions ¶
func CreateDirIfNotExists ¶
func CurrentTimeMillis ¶
func CurrentTimeMillis() uint64
Returns the current Unix timestamp in milliseconds.
func CurrentTimeMillsWithTicker ¶ added in v0.4.0
func CurrentTimeMillsWithTicker() uint64
func CurrentTimeNano ¶
func CurrentTimeNano() uint64
Returns the current Unix timestamp in nanoseconds.
func DecrementAndGetInt64 ¶ added in v0.4.0
func FileExists ¶
func Float64Equals ¶ added in v0.6.0
func FormatDate ¶
FormatDate formats Unix timestamp (ms) to date string
func FormatTimeMillis ¶
FormatTimeMillis formats Unix timestamp (ms) to time string.
func IncrementAndGetInt64 ¶
func RunWithRecover ¶
func RunWithRecover(f func())
func StartTimeTicker ¶ added in v0.4.0
func StartTimeTicker()
StartTimeTicker starts a background task that caches current timestamp per millisecond, which may provide better performance in high-concurrency scenarios.
Types ¶
type AtomicBool ¶
type AtomicBool struct {
// contains filtered or unexported fields
}
func (*AtomicBool) CompareAndSet ¶
func (b *AtomicBool) CompareAndSet(old, new bool) bool
func (*AtomicBool) Get ¶
func (b *AtomicBool) Get() bool
func (*AtomicBool) Set ¶
func (b *AtomicBool) Set(value bool)
type SliceHeader ¶
SliceHeader is a safe version of SliceHeader used within this project.
type StringHeader ¶
StringHeader is a safe version of StringHeader used within this project.
Click to show internal directories.
Click to hide internal directories.