lib

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFileExt

func GetFileExt(path string) string

GetFileExt gets file extension in lower case

func IsReadableDirectory

func IsReadableDirectory(path string) bool

IsReadableDirectory checks whether a readable directory exists at given path

func IsReadableFile

func IsReadableFile(path string) bool

IsReadableFile checks whether argument is a readable file

func LineSeparatedStrToMap

func LineSeparatedStrToMap(lineSeparatedString string) (entries set.Set[string], firstFew []string)

LineSeparatedStrToMap converts a line-separated string to a Set of values

func WriteSliceToFile

func WriteSliceToFile(slice []string, fileName string)

WriteSliceToFile writes a slice of strings to a file

Types

type MultiMap

type MultiMap[K comparable, V any] struct {
	// contains filtered or unexported fields
}

MultiMap is a multi-map to which writes are go-routine safe

func NewMultiMap

func NewMultiMap[K comparable, V any]() (m MultiMap[K, V])

NewMultiMap creates new MultiMap

func (MultiMap[K, V]) Exists

func (m MultiMap[K, V]) Exists(key K) bool

Exists checks whether key exists in map

func (MultiMap[K, V]) Get

func (m MultiMap[K, V]) Get(key K) []V

Get gets all values matching the key

func (MultiMap[K, V]) Set

func (m MultiMap[K, V]) Set(key K, value V)

Set sets a value for the key

type SafeMap

type SafeMap[K comparable, V any] struct {
	Data map[K]V
	// contains filtered or unexported fields
}

SafeMap is a map on which writes are goroutine-safe

func NewSafeMap

func NewSafeMap[K comparable, V any]() (m SafeMap[K, V])

NewSafeMap creates new SafeMap

func (SafeMap[K, V]) Get

func (m SafeMap[K, V]) Get(key K) V

Get gets value for given key

func (SafeMap[K, V]) Len

func (m SafeMap[K, V]) Len() int

Len returns number of elements in map

func (SafeMap[K, V]) Set

func (m SafeMap[K, V]) Set(key K, value V)

Set sets value for a given key in a goroutine-safe way

Jump to

Keyboard shortcuts

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