utils

package
v0.0.0-...-37b99e7 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package utils for utility functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnv

func GetEnv(key, defaultValue string) string

GetEnv get key environment variable if exist otherwise return defalutValue

func MapToProtobufStruct

func MapToProtobufStruct(m map[string]interface{}) (*structpb.Struct, error)

MapToProtobufStruct convert a map to a struct. This helps to encoding the struct to JSON when a message is consumed.

func ObfuscateValue

func ObfuscateValue(input string, char int) string

ObfuscateValue obfuscate the string

func SanitizeErrorMessage

func SanitizeErrorMessage(log error, input ...string) error

SanitizeErrorMessage removes user input from the err output

func SanitizeLogMessage

func SanitizeLogMessage(log string, input ...string) string

SanitizeLogMessage removes user input from the log output

func SanitizeLogMessageF

func SanitizeLogMessageF(log string, input ...string) string

SanitizeLogMessageF removes user input from the log output and format

func SanitizeMessageValue

func SanitizeMessageValue(i interface{}) interface{}

SanitizeMessageValue ensures that a message's value is an int, int64, bool, string

func SanitizeMongoInput

func SanitizeMongoInput(s string) string

SanitizeMongoInput sanitize Mongo input to guard against NoSQL injection

Types

This section is empty.

Jump to

Keyboard shortcuts

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