utils

package module
v0.0.0-...-b352feb Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const CharactersLibrary = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

Variables

This section is empty.

Functions

func GenerateRandomBytes

func GenerateRandomBytes(length int) []byte

GenerateRandomBytes generate random 'length' readable Bytes

func GenerateRandomSlice

func GenerateRandomSlice[T Computable](length int, maxValue T, specialValues ...T) []T

GenerateRandomSlice generate random slice, you can set 'length' and 'max value' of slice

@param length: length of slice, min is 10
@param maxValue: max value of slice element, in fact, slice[i] is random in the area [-'max value', 'max value')
@param specialValues: special values in test, for each method, it may need some special case when test,
                      more values than 'length' will be ignored

func GenerateRandomString

func GenerateRandomString(length int) string

func New

func New[T string | []byte](data ...T) string

New return uuid v4 string, with same 'data', it will return same string, without 'data', it will return random string.

Types

type Computable

type Computable interface {
	int | int8 | int16 | int32 | int64 |
		uint | uint8 | uint16 | uint32 | uint64 |
		float32 | float64
}

Jump to

Keyboard shortcuts

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