utils

package
v0.0.0-...-717446a Latest Latest
Warning

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

Go to latest
Published: Sep 25, 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

func BoolP(val bool) *bool

BoolP returns a pointer to the given bool value. Usage:

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

func Int32P

func Int32P(val int32) *int32

Int32P returns a pointer to the given int32 value. Usage:

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

func Int64P

func Int64P(val int64) *int64

Int64P returns a pointer to the given int64 value. Usage:

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

func IntP

func IntP(val int) *int

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

func PBool(ptr *bool) bool

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

func PInt(ptr *int) int

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

func PInt32(ptr *int32) int32

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

func PInt64(ptr *int64) int64

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

func PString(ptr *string) string

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 StringP

func StringP(val string) *string

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