util

package
v2.4.7+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsBlankString

func IsBlankString(str string) bool

IsBlankString - check whether a given string is blank or has whitespace only

func IsHexString

func IsHexString(str string) bool

IsHexString - check whether a given string is made up of lower-case hexadecimal characters

func RandomBytes

func RandomBytes(n int) ([]byte, error)

RandomBytes - generate random bytes of length n

func RandomHex

func RandomHex(n int) (string, error)

RandomHex - generate random bytes of length n in hex representation. the length of the string returned is 2 * n.

func SHA256

func SHA256(data []byte) []byte

SHA256 - hash data using SHA-256 algorithm

Types

type StringSet

type StringSet map[string]struct{}

StringSet - an unordered collection of unique strings

func NewStringSet

func NewStringSet() StringSet

NewStringSet - initialize a new StringSet

func StringSetFromStringSlice

func StringSetFromStringSlice(slice []string) StringSet

StringSetFromStringSlice - make a string set from a slice of strings

func (StringSet) Add

func (s StringSet) Add(value string)

Add - add value to the set

func (StringSet) Contains

func (s StringSet) Contains(value string) bool

Contains - checks whether the set contains a given value

func (StringSet) Remove

func (s StringSet) Remove(value string)

Remove - remove value from the set

Jump to

Keyboard shortcuts

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