Documentation ¶
Index ¶
- func AppendStrInt(sb *strings.Builder, x int)
- func AppendStrInt32(sb *strings.Builder, x int32)
- func AppendStrInt64(sb *strings.Builder, x int64)
- func AppendStrUInt(sb *strings.Builder, x uint)
- func AppendStrUInt32(sb *strings.Builder, x uint32)
- func AppendStrUInt64(sb *strings.Builder, x uint64)
- func B2S(bts []byte) string
- func ByteToStr(bts []byte) string
- func CPUTicks() int64
- func FastRand() uint32
- func Int32ToStr(x int32) string
- func Int64ToStr(x int64) string
- func IntToStr(x int) string
- func MustSha256(in, out []byte)
- func MustSha512(in, out []byte)
- func NanoTime() int64
- func RandomDigit(n int) string
- func RandomID(n int) string
- func RandomIDs(n ...int) []string
- func RandomInt(n int) (x int)
- func RandomInt32(n int32) (x int32)
- func RandomInt64(n int64) (x int64)
- func RandomUint64(n uint64) (x uint64)
- func S2B(str string) []byte
- func SecureRandomInt63(n int64) (x int64)
- func SecureRandomUint64() (x uint64)
- func Sha256(in, out []byte) error
- func Sha512(in, out []byte) error
- func StrToByte(str string) (b []byte)
- func StrToFloat32(s string) float32
- func StrToFloat64(s string) float64
- func StrToInt(s string) int
- func StrToInt32(s string) int32
- func StrToInt64(s string) int64
- func StrToUInt(s string) uint
- func StrToUInt32(s string) uint32
- func StrToUInt64(s string) uint64
- func TimeUnix() int64
- func TimeUnixSubtract(unixTime int64, d time.Duration) int64
- func ToCamel(s string) string
- func ToDelimited(s string, delimiter uint8) string
- func ToKebab(s string) string
- func ToLowerCamel(s string) string
- func ToScreamingDelimited(s string, delimiter uint8, ignore uint8, screaming bool) string
- func ToScreamingKebab(s string) string
- func ToScreamingSnake(s string) string
- func ToSnake(s string) string
- func ToSnakeWithIgnore(s string, ignore uint8) string
- func UInt32ToStr(x uint32) string
- func UInt64ToStr(x uint64) string
- type LinkedList
- func (ll *LinkedList) Append(data interface{})
- func (ll *LinkedList) Get(index int32) (n *Node)
- func (ll *LinkedList) Head() *Node
- func (ll *LinkedList) PickHeadData() interface{}
- func (ll *LinkedList) PickTailData() interface{}
- func (ll *LinkedList) Prepend(data interface{})
- func (ll *LinkedList) RemoveAt(index int32)
- func (ll *LinkedList) Reset()
- func (ll *LinkedList) Size() int32
- func (ll *LinkedList) String() string
- func (ll *LinkedList) Tail() *Node
- type Node
- type SpinLock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendStrInt ¶
func AppendStrInt32 ¶
func AppendStrInt64 ¶
func AppendStrUInt ¶
func AppendStrUInt32 ¶
func AppendStrUInt64 ¶
func ByteToStr ¶
ByteToStr converts byte slice to a string without memory allocation. Note it may break if string and/or slice header will change in the future go versions.
func CPUTicks ¶
func CPUTicks() int64
CPUTicks is a faster alternative to NanoTime to measure time duration.
func Int32ToStr ¶
func Int64ToStr ¶
func MustSha256 ¶
func MustSha256(in, out []byte)
func MustSha512 ¶
func MustSha512(in, out []byte)
func NanoTime ¶
func NanoTime() int64
NanoTime returns the current time in nanoseconds from a monotonic clock.
func RandomDigit ¶
RandomDigit generates a pseudo-random string with length 'n' which characters are only digits (0-9)
func RandomID ¶
RandomID generates a pseudo-random string with length 'n' which characters are alphanumerics.
func RandomInt32 ¶
RandomInt32 produces a pseudo-random 31bit number, if n == 0 there will be no limit otherwise the output will be smaller than n
func RandomInt64 ¶
RandomInt64 produces a pseudo-random 63bit number, if n == 0 there will be no limit otherwise the output will be smaller than n
func RandomUint64 ¶
RandomUint64 produces a pseudo-random unsigned number
func SecureRandomInt63 ¶
SecureRandomInt63 produces a secure pseudo-random 63bit number
func SecureRandomUint64 ¶
func SecureRandomUint64() (x uint64)
SecureRandomUint64 produces a secure pseudo-random 64bit number
func StrToByte ¶
StrToByte converts string to a byte slice without memory allocation. Note it may break if string and/or slice header will change in the future go versions.
func StrToFloat32 ¶
func StrToFloat64 ¶
func StrToInt32 ¶
func StrToInt64 ¶
func StrToUInt32 ¶
func StrToUInt64 ¶
func TimeUnixSubtract ¶ added in v0.4.5
func ToDelimited ¶
ToDelimited converts a string to delimited.snake.case (in this case `delimiter = '.'`)
func ToLowerCamel ¶
ToLowerCamel converts a string to lowerCamelCase
func ToScreamingDelimited ¶
ToScreamingDelimited converts a string to SCREAMING.DELIMITED.SNAKE.CASE (in this case `delimiter = '.'; screaming = true`) or delimited.snake.case (in this case `delimiter = '.'; screaming = false`)
func ToScreamingKebab ¶
ToScreamingKebab converts a string to SCREAMING-KEBAB-CASE
func ToScreamingSnake ¶
ToScreamingSnake converts a string to SCREAMING_SNAKE_CASE
func ToSnakeWithIgnore ¶
func UInt32ToStr ¶
func UInt64ToStr ¶
Types ¶
type LinkedList ¶
type LinkedList struct {
// contains filtered or unexported fields
}
func NewLinkedList ¶
func NewLinkedList() *LinkedList
func (*LinkedList) Append ¶
func (ll *LinkedList) Append(data interface{})
func (*LinkedList) Get ¶
func (ll *LinkedList) Get(index int32) (n *Node)
func (*LinkedList) Head ¶
func (ll *LinkedList) Head() *Node
func (*LinkedList) PickHeadData ¶
func (ll *LinkedList) PickHeadData() interface{}
func (*LinkedList) PickTailData ¶
func (ll *LinkedList) PickTailData() interface{}
func (*LinkedList) Prepend ¶
func (ll *LinkedList) Prepend(data interface{})
func (*LinkedList) RemoveAt ¶
func (ll *LinkedList) RemoveAt(index int32)
func (*LinkedList) Reset ¶
func (ll *LinkedList) Reset()
func (*LinkedList) Size ¶
func (ll *LinkedList) Size() int32
func (*LinkedList) String ¶
func (ll *LinkedList) String() string
func (*LinkedList) Tail ¶
func (ll *LinkedList) Tail() *Node
type SpinLock ¶
type SpinLock struct {
// contains filtered or unexported fields
}
SpinLock is a spinlock implementation.
A SpinLock must not be copied after first use. This SpinLock intended to be used to synchronize exceptionally short-lived operations.