utils

package
v1.2.10 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesEquals

func BytesEquals(a []byte, b []byte) bool

BytesEquals check whether the given bytes is equal

func ConvertRange

func ConvertRange(start int64, end int64, size int64) (int, int)

ConvertRange converts redis index to go slice index -1 => size-1 both inclusive [0, 10] => left inclusive right exclusive [0, 9) out of bound to max inbound [size, size+1] => [-1, -1]

func Equals

func Equals(a interface{}, b interface{}) bool

Equals check whether the given value is equal

func RandHexString

func RandHexString(n int) string

func RandIndex

func RandIndex(size int) []int

RandIndex returns random indexes to random pick elements from slice

func RandString

func RandString(n int) string

RandString create a random string no longer than n

func RemoveDuplicates

func RemoveDuplicates(input [][]byte) [][]byte

RemoveDuplicates removes duplicate byte slices from a 2D byte slice

func ToCmdLine

func ToCmdLine(cmd ...string) [][]byte

ToCmdLine convert strings to [][]byte

func ToCmdLine2

func ToCmdLine2(commandName string, args ...string) [][]byte

ToCmdLine2 convert commandName and string-type argument to [][]byte

func ToCmdLine3

func ToCmdLine3(commandName string, args ...[]byte) [][]byte

ToCmdLine3 convert commandName and []byte-type argument to CmdLine

Types

This section is empty.

Jump to

Keyboard shortcuts

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