Documentation
¶
Overview ¶
error_helpers.go
string_helpers.go
Index ¶
- Variables
- func CheckPasswordHash(password, hashedPassword string) bool
- func ConfigLogger()
- func Contains(slice []int, item int) bool
- func EncryptAES(plaintext, key string) (string, error)
- func GenerateJWTSecretKey(length int) (string, error)
- func GetCurrentTimestampHex() string
- func HashPassword(password string) (string, error)
- func LogError(err error, msg string, depth ...int)
- func LogFatal(err error, msg string, depth ...int)
- func LogInfo(format string, args ...interface{})
- func ParseHexSubstring(hexStr string, byteOffset, byteLength int) (int, int, error)
- func ParseHexSubstringBigInt(hexStr string, byteOffset, byteLength int) (*big.Int, int, error)
- func ParseHexToASCIIString(hexStr string, byteOffset int, byteLength int) (string, int, error)
- func PrettyPrintJSON(data any)
- func RespondWithError(w http.ResponseWriter, err error, message string, statusCode int, depth ...int)
- func Splice[T any](slice []T, start, count int, elementsToAdd []T) ([]T, []T)
- func SplitIntoPairs(input string) []string
- func StopLogging()
- func StructSliceToMapSlice(slice any) ([]map[string]any, error)
- func StructToMap(v any) (map[string]any, error)
- func WrapError(err error) error
Constants ¶
This section is empty.
Variables ¶
var EmailRegex = regexp.MustCompile(`^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$`)
Email regex pattern
Functions ¶
func CheckPasswordHash ¶
func ConfigLogger ¶
func ConfigLogger()
func EncryptAES ¶
func GenerateJWTSecretKey ¶
func GetCurrentTimestampHex ¶
func GetCurrentTimestampHex() string
func HashPassword ¶
func LogInfo ¶
func LogInfo(format string, args ...interface{})
LogInfo logs an informational message with formatting options.
func ParseHexSubstring ¶
parseHexSubstring extracts an integer value from a specified hex substring within a larger hex string, based on the offset and length in bytes.
func ParseHexSubstringBigInt ¶
ParseHexSubstringBigInt extracts a large integer value from a specified hex substring within a larger hex string, based on the offset and length in bytes, returning *big.Int.
func ParseHexToASCIIString ¶
ParseHexToASCIIString converts a segment of a hex string starting at byteOffset for byteLength bytes into its ASCII string representation.
func PrettyPrintJSON ¶
func PrettyPrintJSON(data any)
PrettyPrintJSON takes any data and prints it in an indented JSON format
func RespondWithError ¶
func RespondWithError(w http.ResponseWriter, err error, message string, statusCode int, depth ...int)
RespondWithError logs the error, captures file/line, and sends a detailed error response.
func SplitIntoPairs ¶
splitIntoPairs splits a string into pairs of two characters.
func StructSliceToMapSlice ¶
StructSliceToMapSlice converts a slice of structs into a slice of map[string]any.
func StructToMap ¶
StructToMap converts a struct to a map[string]any using JSON marshaling and unmarshaling.
Types ¶
This section is empty.