utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OrganizationIDContextKey is the key used to add an organizationID to the context
	OrganizationIDContextKey = ContextKey("OrganizationID")

	// FacilityIDContextKey is the key used to add a facility to the context
	FacilityIDContextKey = ContextKey("FacilityID")
)
View Source
const (
	// TopicVersion defines the topic version. That standard one is `v1`
	TopicVersion = "v2"
)

Variables

This section is empty.

Functions

func AddPubSubNamespace added in v1.0.0

func AddPubSubNamespace(topicName, serviceName string) string

func ReportErrorToSentry added in v1.0.0

func ReportErrorToSentry(err error)

ReportErrorToSentry captures the exception thrown and registers an issue in sentry

func ValidateEmail

func ValidateEmail(email string) error

ValidateEmail returns an error if the supplied string does not have a valid format or resolvable host

Types

type ContextKey added in v1.0.0

type ContextKey string

ContextKey is a custom type used as a key value when adding IDs to the context This is because using a built-in type as a context key can cause collisions with keys used by other packages, leading to unexpected behavior.

type CustomError added in v1.0.0

type CustomError struct {
	Err     error  `json:"error,omitempty"`
	Message string `json:"message,omitempty"`
}

CustomError represents a custom error struct Reference https://blog.golang.org/error-handling-and-go

func NewCustomError added in v1.0.0

func NewCustomError(err error, message string) CustomError

NewCustomError is a helper function to create a new custom error

func (CustomError) Error added in v1.0.0

func (e CustomError) Error() string

Error implements the error interface

Jump to

Keyboard shortcuts

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