general_goutils

package module
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: MIT Imports: 20 Imported by: 4

README

go get github.com/danielcomboni/general-go-utils@v0.3.2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger *zap.Logger
View Source
var ShouldLogToFile = false

Functions

func AnyToString added in v0.1.4

func AnyToString(i any) string

func CheckPassword added in v0.2.6

func CheckPassword(providedPassword, existingPassword string) (bool, string, error)

func ConvertFloat64ToStr added in v0.1.5

func ConvertFloat64ToStr(floatValue float64, precision int) string

func ConvertInt64ToStr added in v0.1.5

func ConvertInt64ToStr(intValue int64) string

func ConvertStrToFloat64 added in v0.1.5

func ConvertStrToFloat64(str string) float64

func ConvertStrToInt64 added in v0.1.5

func ConvertStrToInt64(str string) int64

func GetFieldValue added in v0.2.1

func GetFieldValue[T any](t *T, field string) interface{}

GetFieldValue returns the value of the specified field/property of the struct t

func GetFromByteArray added in v0.1.3

func GetFromByteArray(b []byte) (*gabs.Container, error)

func GetIncomingCase added in v0.1.3

func GetIncomingCase(r *http.Request) (*gabs.Container, error)

func GetIncomingCaseRoot added in v0.1.3

func GetIncomingCaseRoot(r *http.Request, shouldLog bool) (*gabs.Container, error)

func GetRootJsonObjectPreCreated added in v0.1.3

func GetRootJsonObjectPreCreated(dynamicPropertyByteArray []byte) *gabs.Container

func GetType added in v0.1.4

func GetType(i interface{}) string

func HasField

func HasField[T any](fieldName string) bool

HasField returns true if the struct [T] has the field specified by `fieldName`. This is a case sensitive test

func HasField_CaseInsensitive added in v0.2.1

func HasField_CaseInsensitive[T any](fieldName string) bool

HasField_CaseInsensitive returns true if the struct [T] has the field specified by `fieldName`. This is a case insensitive test

func HashPassword added in v0.2.6

func HashPassword(password string) (string, error)

func Initialize added in v0.1.3

func Initialize()

func InterfaceToString added in v0.1.4

func InterfaceToString(i interface{}) string

func IsGreaterThan added in v0.1.6

func IsGreaterThan[T Number](value, expected T) bool

IsGreaterThan returns true if `value` is greater than `expected`

func IsGreaterThanOrEqualTo added in v0.1.6

func IsGreaterThanOrEqualTo[T Number](value, expected T) bool

IsGreaterThanOrEqualTo returns true if `value` is greater than or equal to `expected`

func IsLessThan added in v0.1.6

func IsLessThan[T Number](value, expected T) bool

IsLessThan returns true if `value` is less than `expected`

func IsLessThanOrEqualTo added in v0.1.6

func IsLessThanOrEqualTo[T Number](value, expected T) bool

IsLessThanOrEqualTo returns true if `value` is less than or equal to `expected`

func IsNullOrEmpty added in v0.1.3

func IsNullOrEmpty(i interface{}) bool

func IsPasswordHashed added in v0.2.6

func IsPasswordHashed(password string) bool

func ParseDynamic added in v0.1.3

func ParseDynamic(r *http.Request) (interface{}, error)

func ParseIncoming added in v0.1.3

func ParseIncoming(r *http.Request) (interface{}, error)

ParseIncoming sets the root property as "data"

func ParseIncomingDataAndItsDynamicProperty added in v0.1.3

func ParseIncomingDataAndItsDynamicProperty(r *http.Request) (interface{}, interface{}, string, error)

ParseIncomingDataAndItsDynamicProperty returns incoming data, dynamicProperty and a loggable incoming data

func ParseIncomingIntoGabsRoot added in v0.1.3

func ParseIncomingIntoGabsRoot(r *http.Request) (*gabs.Container, error)

func ReInitializeLoggingWithFileSyncEnabled added in v0.2.5

func ReInitializeLoggingWithFileSyncEnabled()

func SafeGet added in v0.1.4

func SafeGet(jsonString string, selector string) interface{}

func SafeGetFromInterface added in v0.1.4

func SafeGetFromInterface(i interface{}, selector string) interface{}

func SafeGetFromInterfaceErrorCaught added in v0.1.4

func SafeGetFromInterfaceErrorCaught(i interface{}, selector string) (interface{}, error)

func SafeGetFromInterfaceGeneric added in v0.1.4

func SafeGetFromInterfaceGeneric[t any](i interface{}, selector string) any

func SafeGetFromInterfaceGenericAndDeserialize added in v0.1.4

func SafeGetFromInterfaceGenericAndDeserialize[T any](i interface{}, selector string) T

func SafeGetMarshalled added in v0.1.4

func SafeGetMarshalled(jsonString string, selector string) []byte

func SafeGetToString added in v0.1.4

func SafeGetToString(jsonString string, selector string) string

func SaveEncryptedConfig added in v0.2.6

func SaveEncryptedConfig(encryptedConfig string)

SaveEncryptedConfig saves encrypted config to disk

func StringContains added in v0.1.6

func StringContains(str, containedSubStr string) bool

StringContains returns true if `str` contains `containedSubStr`

func ToCamelCase added in v0.2.4

func ToCamelCase(s string) string

func ToCamelCaseLower added in v0.1.9

func ToCamelCaseLower(s string) string

func ToSnakeCase added in v0.1.9

func ToSnakeCase(s string) string

Types

type Number added in v0.1.6

type Number interface {
	int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64 | float32 | float64
}

type ValidationsCheck added in v0.1.6

type ValidationsCheck struct {
	Value interface{} `json:"value"`
}

Jump to

Keyboard shortcuts

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