utils

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2025 License: Apache-2.0 Imports: 7 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolP deprecated

func BoolP(val bool) *bool

Deprecated: Use Pointer instead. BoolP returns a pointer to the given bool value. Usage:

ptr := utils.BoolP(true) // *bool pointing to true

func Dereference

func Dereference[T any](p *T) T

Dereference returns the value of a pointer, or the zero value if the pointer is nil. Usage:

val := utils.Dereference(ptr) // returns value pointed by ptr, or zero value if ptr is nil

func Int32P deprecated

func Int32P(val int32) *int32

Deprecated: Use Pointer instead. Int32P returns a pointer to the given int32 value. Usage:

ptr := utils.Int32P(42) // *int32 pointing to 42

func Int64P deprecated

func Int64P(val int64) *int64

Deprecated: Use Pointer instead. Int64P returns a pointer to the given int64 value. Usage:

ptr := utils.Int64P(42) // *int64 pointing to 42

func IntP deprecated

func IntP(val int) *int

Deprecated: Use Pointer instead. IntP returns a pointer to the given int value. Usage:

ptr := utils.IntP(42) // *int pointing to 42

func IsValidEmail

func IsValidEmail(email string) bool

IsValidEmail returns true if the provided string is a valid email address format. Usage:

valid := utils.IsValidEmail("user@example.com") // returns true
valid := utils.IsValidEmail("not-an-email")     // returns false

func PBool deprecated

func PBool(ptr *bool) bool

Deprecated: Use Dereference instead. PBool returns the value of a *bool pointer, or false if the pointer is nil. Usage:

val := utils.PBool(ptr) // returns value pointed by ptr, or false if ptr is nil

func PInt deprecated

func PInt(ptr *int) int

Deprecated: Use Dereference instead. PInt returns the value of a *int pointer, or 0 if the pointer is nil. Usage:

val := utils.PInt(ptr) // returns value pointed by ptr, or 0 if ptr is nil

func PInt32 deprecated

func PInt32(ptr *int32) int32

Deprecated: Use Dereference instead. PInt32 returns the value of a *int32 pointer, or 0 if the pointer is nil. Usage:

val := utils.PInt32(ptr) // returns value pointed by ptr, or 0 if ptr is nil

func PInt64 deprecated

func PInt64(ptr *int64) int64

Deprecated: Use Dereference instead. PInt64 returns the value of a *int64 pointer, or 0 if the pointer is nil. Usage:

val := utils.PInt64(ptr) // returns value pointed by ptr, or 0 if ptr is nil

func PString deprecated

func PString(ptr *string) string

Deprecated: Use Dereference instead. PString returns the value of a *string pointer, or "" if the pointer is nil. Usage:

val := utils.PString(ptr) // returns value pointed by ptr, or "" if ptr is nil

func Pointer

func Pointer[T any](v T) *T

Pointer returns a pointer to the given value. Usage:

ptr := utils.Pointer(42) // *int pointing to 42
ptr := utils.Pointer("hello") // *string pointing to "hello"

func StringP deprecated

func StringP(val string) *string

Deprecated: Use Pointer instead. StringP returns a pointer to the given string value. Usage:

ptr := utils.StringP("hello") // *string pointing to "hello"

Types

type IOEncryptor

type IOEncryptor interface {
	// Encrypt a given object
	EncryptObject(o interface{}) (interface{}, error)

	// Encrypt a given string message
	EncryptString(message string) (string, error)

	// Decrypt an existing encrypted object
	DecryptObject(o interface{}) (interface{}, error)

	// Decrypt an existing encrypted string
	DecryptString(ciphermessage string) (string, error)
}

IOEncryptor is responsible for encrypting and decrypting objects while transacting with an IO ensuring capability of handling secret fields available as part of the data. while avoiding heavy usage of Vaults and HSM for High Transaction interfaces

func GetObjectEncryptor

func GetObjectEncryptor(provider string) (IOEncryptor, error)

func InitializeEncryptor

func InitializeEncryptor(provider, key string) (IOEncryptor, error)

InitializeEncryptor initialize a new Encryptor for given provider, this will return an error if encryptor already exists

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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