Categorygithub.com/pajbot/utils
modulepackage
1.0.0
Repository: https://github.com/pajbot/utils.git
Documentation: pkg.go.dev

# README

utils

golang utils I like

# Functions

No description provided by the author
No description provided by the author
BoolPtr returns a bool pointer of the given bool value.
BytesToFloat32 takes a slice of 4 bytes and converts it to a float32 value.
BytesToUint64 takes a slice of 8 bytes and returns an uint64 value NOTE: bytes must be 8 length here, or else it will panic.
No description provided by the author
CheckFlag returns true if the given flag is enabled in the value.
arr = ["a", "b", "c", "d", "e"] ChunkStringSlice(arr, 2) ret = [ [ "a", "b"], ["c", "d"], ["e"] ].
CombineUint32 returns the packed uint64 value of two uint32's.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
FloatToString converts a float value to a string with sane defaults.
No description provided by the author
GenerateRandomBytes returns securely generated random bytes.
GenerateRandomString returns a securely generated random string.
GenerateRandomStringURLSafe returns a URL-safe, base64 encoded securely generated random string.
GetEnv returns an environment key from the system, with an optional value if the environment key isn't set.
GetTriggers returns a list of strings that have been parsed in accordance to the command rules.
GetTriggersKC returns a list of strings that have been parsed in accordance to the command rules, but keeps the case.
GetTriggersN returns a list of strings that have been parsed in accordance to the command rules.
InsertUnique inserts a string into a target string splice if it doesn't already exist in it.
Int32ToBytes converts a int32 value into a slice of its 4 bytes.
No description provided by the author
No description provided by the author
IsValidUserID verifies that the given user id is not empty, and that it only contains valid characters It does not to any length-checks, as there are no clear rules as to how short or long a user ID can be.
IsValidUsername verifies that the given user name is not empty, and that it only contains valid characters (0-9 a-z A-Z _) It does not to any length-checks, as there are no unbroken rules as to how short or long a user name can be.
MakeVariations makes normal-case and lowercase variatinos of a string.
No description provided by the author
No description provided by the author
No description provided by the author
NewStringPtr returns the pointer to the given string.
No description provided by the author
No description provided by the author
RandIntN generates a number between min and max (inclusive).
ReadArg reads a string until \n and trims all whitespace.
No description provided by the author
No description provided by the author
RemoveNewlines replaces all \r and \n with spaces.
Round returns the rounded value of a float64 up to N places.
No description provided by the author
SplitUint64 spits a uint64 value into two uint32 values.
No description provided by the author
Sum returns the sum of the given slice of ints */.
No description provided by the author
Uint32ToBytes converts a uint32 value into a slice of its 4 bytes.
Uint64ToBytes converts a uint64 value into a slice of its 8 bytes.
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author

# Type aliases

No description provided by the author