utils

package
v1.8.9 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateRandomAlphaNumeric

func GenerateRandomAlphaNumeric(size int) string

GenerateRandomAlphaNumeric generates a random alphanumeric string of the specified size.

Parameters: - size: the length of the generated alphanumeric string Return type: string

func GetLoggerFromContext

func GetLoggerFromContext(ctx context.Context) any

func GetMemberFromContext

func GetMemberFromContext(ctx context.Context) any

func MapContainsKey

func MapContainsKey(m map[string]string, k string) bool

MapContainsKey checks if the given map contains the specified key.

Parameters: - m: the map to search in - k: the key to search for Return type: bool Returns true if the map contains the key, false otherwise.

func MapContainsValue

func MapContainsValue(m map[string]string, v string) bool

MapContainsValue checks if the given map contains the specified value.

Parameters: - m: the map to search in - v: the value to search for Return type: bool Returns true if the map contains the value, false otherwise.

func SetLoggerToContext

func SetLoggerToContext(ctx context.Context, logger any) context.Context

func SetMemberToContext

func SetMemberToContext(ctx context.Context, member any) context.Context

func StringSliceContains

func StringSliceContains(s []string, e string) bool

func StringSliceContainsOneOf

func StringSliceContainsOneOf(s []string, e []string) bool

StringSliceContainsOneOf checks if any element in slice 'e' is present in slice 's'.

Parameters: - s: the slice to check against - e: the slice containing elements to check Return type: bool

func StringSliceHasAll

func StringSliceHasAll(s []string, e []string) bool

StringSliceHasAll checks if all elements in slice 'e' are present in slice 's'.

Parameters: - s: the slice to check against - e: the slice containing elements to check Return type: bool

Types

type ContextKey

type ContextKey string
const (
	MEMBER ContextKey = "member"
	LOGGER ContextKey = "logger"
)

Jump to

Keyboard shortcuts

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