stringsutil

package
v0.0.0-...-4abda61 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Regular expression will match on the following URL formats:
	//		redis://127.0.0.1:6379
	//		redis://localhost:6379/5
	//		127.0.0.1:6379/57
	//		localhost:6379/156
	RedisURLRegex = `^(?:redis:\/\/)?([^:]+:\d+)(?:\/(\d+))?$`
)

Variables

This section is empty.

Functions

func ConvertStringToUUID

func ConvertStringToUUID(s string) uuid.UUID

ConvertStringToUUID converts a string to a UUID.

Parameters:

s string - The string to be converted.

Returns:

uuid.UUID - The UUID converted from the string.

func ConvertStringsToUUIDs

func ConvertStringsToUUIDs(strings []string) []uuid.UUID

ConvertStringsToUUIDs converts a slice of strings to a slice of UUIDs, skipping any strings that are not valid UUIDs.

Parameters:

strings []string - A slice of strings to be converted.

Returns:

[]uuid.UUID - A slice containing the UUIDs converted from the valid strings.

func ConvertUUIDToStringPtr

func ConvertUUIDToStringPtr(uuid uuid.UUID) *string

ConvertUUIDToStringPtr converts a given UUID to its string representation and returns a pointer to the resulting string.

Parameters:

  • uuid: The UUID to be converted.

Returns:

  • A pointer to the string representation of the provided UUID.

func ConvertUUIDsToStrings

func ConvertUUIDsToStrings(uuids []uuid.UUID) []string

ConvertUUIDsToStrings converts a slice of UUIDs to a slice of their string representations.

Parameters:

uuids []uuid.UUID - A slice of UUIDs to be converted.

Returns:

[]string - A slice containing the string representations of the provided UUIDs.

func GenerateRandomCode

func GenerateRandomCode(length int) (string, error)

GenerateRandomCode generates a random code of the given length.

func IsBlank

func IsBlank(s string) bool

IsBlank returns true if a string is empty or contains only whitespace.

func RedisOptionsFromURL

func RedisOptionsFromURL(redisURL string) (address string, dbIndex int, err error)

Returns a parsed Redis address and DB index from URL string

Types

This section is empty.

Jump to

Keyboard shortcuts

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