sty_shared

package
v2024.4.9 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 6 Imported by: 6

Documentation

Overview

Package sty_shared

This is the STY-Holdings shared services

NOTES:

None

COPYRIGHT & WARRANTY:

Copyright (c) 2022 STY-Holdings, inc
All rights reserved.

This software is the confidential and proprietary information of STY-Holdings, Inc.
Use is subject to license terms.

Unauthorized copying of this file, via any medium is strictly prohibited.

Proprietary and confidential

Written by <Replace with FULL_NAME> / syacko
STY-Holdings, Inc.
support@sty-holdings.com
www.sty-holdings.com

01-2024
USA

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Package sty_shared

This is the STY-Holdings shared services

NOTES:

None

COPYRIGHT & WARRANTY:

Copyright (c) 2022 STY-Holdings, inc
All rights reserved.

This software is the confidential and proprietary information of STY-Holdings, Inc.
Use is subject to license terms.

Unauthorized copying of this file, via any medium is strictly prohibited.

Proprietary and confidential

Written by <Replace with FULL_NAME> / syacko
STY-Holdings, Inc.
support@sty-holdings.com
www.sty-holdings.com

01-2024
USA

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Package sty_shared

This is the STY-Holdings shared services

NOTES:

None

COPYRIGHT & WARRANTY:

Copyright (c) 2022 STY-Holdings, inc
All rights reserved.

This software is the confidential and proprietary information of STY-Holdings, Inc.
Use is subject to license terms.

Unauthorized copying of this file, via any medium is strictly prohibited.

Proprietary and confidential

Written by <Replace with FULL_NAME> / syacko
STY-Holdings, Inc.
support@sty-holdings.com
www.sty-holdings.com

01-2024
USA

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Package sty_shared

This is the STY-Holdings shared services

NOTES:

None

COPYRIGHT & WARRANTY:

Copyright (c) 2022 STY-Holdings, inc
All rights reserved.

This software is the confidential and proprietary information of STY-Holdings, Inc.
Use is subject to license terms.

Unauthorized copying of this file, via any medium is strictly prohibited.

Proprietary and confidential

Written by Scott Yacko / syacko
STY-Holdings, Inc.
support@sty-holdings.com
www.sty-holdings.com

01-2024
USA

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Index

Constants

View Source
const (
	ERROR    = "error"
	NO_ERROR = "no error"
	//
	//
	EXPECTED_ERROR_FORMAT     = "%v Failed: Was expecting an err."
	EXPECTING_NO_ERROR_FORMAT = "%v Failed: Wasn't expecting an err. ERROR: %v"
	UNEXPECTED_ERROR_FORMAT   = "%v Failed: Unexpected err. ERROR: %v"
	//
	// Messages
	ACCESS_TOKEN_MISSING               = "No access token was provided."
	ADDRESS_MISSING                    = "The profile address is missing information. Please review the street, city, state, and zip code."
	ALREADY_CONFIRMED_EMAIL            = "The SavUp account has already need confirmed by email."
	ALREADY_CONFIRMED_PHONE            = "The SavUp account has already need confirmed by phone."
	AREA_CODE_PHONE_NUMBER_MISSING     = "Either the area code or the phone number is missing."
	ATTEMPTS_EXCEEDED                  = "LimitExceededException: Attempt limit exceeded, please try after some time."
	BASE64_INVALID                     = "The base64 stringis invalid."
	BUCKET_NOT_FOUND                   = "The bucket was not found."
	BUFFER_EMPTY                       = "The buffer is empty"
	BUNDLE_ALREADY_EXISTS              = "Bundle already exists in the SavUp system."
	BUNDLE_MISSING                     = "Bundle is not in the SavUp system."
	COGNITO_USER_NAME_MISSING          = "Username is not in the Cognito user pool."
	CONFIG_FILE_MISSING                = "Not able to read the supplied config file. "
	DIRECTORY_MISSING                  = "The directory does not exist."
	DIRECTORY_NOT_FULLY_QUALIFIED      = "The directory doesn't start and end with slash."
	DOCUMENT_NOT_FOUND                 = "The document was not found."
	DOCUMENTS_NONE_FOUND               = "No documents were found."
	DOMAIN_INVALID                     = "The domain value is invalid."
	EVIRNOMENT_INVALID                 = "The environment value is invalid."
	ERROR_MISSING                      = "ERROR MISSING"
	EXTENSION_INVALID                  = "The extensioin name is invalid."
	FALSE_SHOULD_BE_TRUE               = "The result should have been true."
	FILE_CREATION_FAILED               = "Create the file failed."
	FILE_MISSING                       = "The file doesn't exist."
	FILE_REMOVAL_FAILED                = "The file was not deleted."
	FILE_UNREADABLE                    = "[ERROR} The file is not readable."
	FIREBASE_GC_PROJECT_ID_MISSING     = "No Firebase project id was provided."
	FIRST_NAME_MISSING                 = "The first name is empty."
	FIRST_LAST_NAME_MISSING            = "Either the first or the last name is missing."
	GIN_MODE_INVALID                   = "The Gin mode is invalid."
	GREATER_THAN_ZERO                  = "The value must be greater than zero."
	HTTP_REQUEST_FALIED                = "The HTTP request failed with a non-200 status code."
	HTTP_SECURE_SERVER_FAILED          = "The HTTP services secure server failed."
	JSON_GENERATION_FAILED             = "Failed to generate JSON payload"
	JSON_INVALID                       = "The JSON provided is invalid"
	LAST_NAME_MISSING                  = "The last name is empty."
	MAP_IS_EMPTY                       = "Provided map is not populated."
	MAP_MISSING_KEY                    = "Provided map has a nil or empty key."
	MAP_MISSING_VALUE                  = "Provided map has a nil or empty value."
	MAX_THREADS_INVALID                = "The config file max threads value is invalid."
	NATS_ZERO                          = "The port value is zero. This is not allowed. Recommended values are 4222 and 9222."
	MESSAGE_JSON_INVALID               = "The message body is not valid JSON."
	MESSAGE_NAMESPACE_INVALID          = "The Message namespace value is invalid."
	MISSING_SERVER_NAME                = "The server name in main.go is empty."
	NATS_URL_INVALID                   = "The NATS URL value is invalid."
	NATS_CONNECTION_FAILED             = "Connecting to NATS server failed"
	PID_FILE_EXISTS                    = "A PID file already exists. Delete the 'server.pid' file in '.run' directory and start the server again."
	PLAID_INVALID_PUBLIC_TOKEN         = "INVALID_PUBLIC_TOKEN" // DO NOT change this, it is used to test a condition
	POINTER_MISSING                    = "You must pass a pointer. Nil is not valid!"
	POSTGRES_SSL_MODE                  = "Only disable, allow, prefer and required are supported."
	POSTGRES_CONN_FALIED               = "No database connection has been established"
	POSTGRES_CONN_EMPTY                = "Database connection is empty"
	REDIRECT_MODE_MISSING              = "The redirect mode is missing."
	REDIRECT_MODE_INVALID              = "The redirect mode is invalid."
	REFRESH_TOO_SOON                   = "Too soon to refresh balances."
	REQUESTOR_ID_MISSING               = "The requestor id is missing."
	REQUIRED_ARGUMENT_MISSING          = "A required argument is empty."
	REQUIRED_FILE_MISSING              = "A required file is missing."
	RETRY_LIMIT_HIT                    = "You have tried too many times. Please try again in 15 mins or contact support@sty-holdings.com."
	SERVER_CONFIGURATION_INVALID       = "The setting in the configuration file are inconsistant."
	SERVICE_FAILED_AWS                 = "AWS service has failed. Investigate right away!"
	SERVICE_FAILED_FIREBASE            = "FIREBASE service has failed. Investigate right away!"
	SERVICE_FAILED_FIRESTORE           = "FIRESTORE service has failed. Investigate right away!"
	SERVICE_FAILED_PLAID               = "PLAID service has failed. Investigate right away!"
	SERVICE_FAILED_POSTGRES            = "POSTGRES service has failed. Investigate right away!"
	SERVICE_FAILED_SENDGRID            = "SENDGRID service has failed. Investigate right away!"
	SERVICE_FAILED_STRIPE              = "STRIPE service has failed. Investigate right away!"
	SHORT_URL_ALREADY_EXISTS           = "Short URL already exists in the SavUp system."
	SHORT_URL_MISSING                  = "Short URL is not in the SavUp system."
	SIGNAL_UNKNOWN                     = "Unknown signal was caught and ignored."
	STRIPE_AMOUNT_INVALID              = "The amount must be a positive number. See https://docs.stripe.com/api/payment_intents."
	STRIPE_CURRENCY_INVALID            = "The curreny type is not supported. See https://docs.stripe.com/api/payment_intents."
	STRIPE_CUSTOMER_FAILED             = "Creating a Stripe customer failed."
	STRIPE_PAYMENT_INTENT_ID_EMPTY     = "An empty payment intent id is not allowed. See https://docs.stripe.com/api/payment_intents."
	STRIPE_PAYMENT_METHOD_EMPTY        = "An empty payment method is not allowed. See https://docs.stripe.com/testing?testing-method=payment-methods#cards."
	STRIPE_PAYMENT_METHOD_INVALID      = "The payment method is not support by NATS Connect. See https://docs.stripe.com/testing?testing-method=payment-methods#cards."
	STRIPE_PAYMENT_METHOD_TYPE_EMPTY   = "" /* 127-byte string literal not displayed */
	STRIPE_PAYMENT_METHOD_TYPE_INVALID = "" /* 138-byte string literal not displayed */
	STRIPE_KEY_INVALID                 = "The stripe key is invalid. See https://docs.stripe.com/api/payment_intents source."
	STRIPE_METHOD_TYPE_UNSUPPORTED     = "The payment method is not support. To request support, contact support@sty-holdings.com."
	STRIPE_ONE_TIME_CODE_FAILED        = "Generating the Stripe One Time Use Token failed."
	STRIPE_OUT_NOT_SUPPORTED           = "Transfers out of SavUp using Stripe are not supported."
	STRIPE_SOURCE_INVALID              = "The provided source is invalid. See https://docs.stripe.com/api/payment_intents."
	STRUCT_INVALID                     = "Provided object is not a struct."
	SUBJECTS_MISSING                   = "No subject(s) have been defined for the NATS extension."
	SUBJECT_SUBSCRIPTION_FAILED        = "Unable to subscribe to the subject."
	SUBJECT_INVALID                    = "The subject is invalid."
	TLS_FILES_MISSING                  = "TLS files are missing."
	TOKEN_CLAIMS_INVALID               = "The token claims are invalid."
	TOKEN_EXPIRED                      = "The token has expired."
	TOKEN_INVALID                      = "The token is invalid."
	TRANSFER_AMOUNT_INVALID            = "The transfer amount is not support for this transfer method!"
	TRANSFER_IN_NOT_ALLOWED            = "Transferring money to SavUp is not allowed for this transfer method."
	TRANSFER_METHOD_INVALID            = "The transfer method is not support! (Transfer Method is case insensitive)"
	TRANSFER_OUT_NOT_ALLOWED           = "Transferring money from SavUp is not allowed for this transfer method."
	TRUE_SHOULD_BE_FALSE               = "The result should have been false."
	UNABLE_READ_FILE                   = "Unable to read file."
	UNCONFIRMED_EMAIL                  = "Users email has not been confirmed."
	UNEXPECTED_ERROR                   = "The system has experienced an unexpected issue. Investigate right away!"
	UNSUPPORTED_TRANSFER_METHOD        = "The transfer method is not supported."
	USER_ACCOUNT_ALREADY_EXISTS        = "User account already exists in the SavUp system."
	USER_ACCOUNT_MISSING               = "User account is not in the SavUp system."
	USER_ALREADY_EXISTS                = "User already exists in the SavUp system."
	UNAUTHORIZED_REQUEST               = "You are not authorized to use this system."
	UNMARSHAL_FAILED                   = "Unable to unmarshal data"
	USER_BUNDLE_ALREADY_EXISTS         = "User bundle already exists in the SavUp system."
	USER_BUNDLE_MISSING                = "User bundle is not in the SavUp system."
	USER_MISSING                       = "User is not in the SavUp system."
	VERSION_INVALID                    = "The software version is invalid. Use @env GOOS=linux GOARCH=amd64 go build -ldflags \"-X main.version=$(" +
		"VERSION)\" -o ${ROOT_DIRECTORY}/servers/${SERVER_NAME}/bin/${SERVER_NAME} ${ROOT_DIRECTORY}/servers/${SERVER_NAME}/main.go"
	//
	// String that are used to determine third party error messages
	USER_DOES_NOT_EXIST = "User does not exist."
	NOT_FOUND           = "not found"
	UNKNOWN             = "UNKNOWN"
	//
	// Testing Strings
	TEST_STRING = "TEST STRING"
)
View Source
const (
	DEBUG_FUNCTION_FORMAT = "[DEBUG_FUNCTION] File: %v Function Name: '%v' Near Line Number: %v\n"
	DEBUG_MESSAGE_FORMAT  = "[DEBUG_MESSAGE] File: %v Function Name: '%v' Message: %v\n"
)

Variables

View Source
var (
	ErrAccessTokenMissing             = errors.New(ACCESS_TOKEN_MISSING)
	ErrAddressMissing                 = errors.New(ADDRESS_MISSING)
	ErrAlreadyConfirmedEmail          = errors.New(ALREADY_CONFIRMED_EMAIL)
	ErrAlreadyConfirmedPhone          = errors.New(ALREADY_CONFIRMED_PHONE)
	ErrAreaCodePhoneNumberMissing     = errors.New(AREA_CODE_PHONE_NUMBER_MISSING)
	ErrAttemptsExceeded               = errors.New(ATTEMPTS_EXCEEDED)
	ErrBase64Invalid                  = errors.New(BASE64_INVALID)
	ErrBucketNotFound                 = errors.New(BUCKET_NOT_FOUND)
	ErrBufferEmpty                    = errors.New(BUFFER_EMPTY)
	ErrBundleAlreadyExists            = errors.New(BUNDLE_ALREADY_EXISTS)
	ErrBundleMissing                  = errors.New(BUNDLE_MISSING)
	ErrCognitoUsernameMissing         = errors.New(COGNITO_USER_NAME_MISSING)
	ErrConfigFileMissing              = errors.New(CONFIG_FILE_MISSING)
	ErrDirectoryMissing               = errors.New(DIRECTORY_MISSING)
	ErrDirectoryNotFullyQualified     = errors.New(DIRECTORY_NOT_FULLY_QUALIFIED)
	ErrDocumentNotFound               = errors.New(DOCUMENT_NOT_FOUND)
	ErrDocumentsNoneFound             = errors.New(DOCUMENTS_NONE_FOUND)
	ErrDomainInvalid                  = errors.New(DOMAIN_INVALID)
	ErrEnvironmentInvalid             = errors.New(EVIRNOMENT_INVALID)
	ErrErrorMissing                   = errors.New(ERROR_MISSING)
	ErrExtensionInvalid               = errors.New(EXTENSION_INVALID)
	ErrFalseShouldBeTrue              = errors.New(FALSE_SHOULD_BE_TRUE)
	ErrFileCreationFailed             = errors.New(FILE_CREATION_FAILED)
	ErrFileMissing                    = errors.New(FILE_MISSING)
	ErrFileRemovalFailed              = errors.New(FILE_REMOVAL_FAILED)
	ErrFileUnreadable                 = errors.New(FILE_UNREADABLE)
	ErrFirstNameMissing               = errors.New(FIRST_NAME_MISSING)
	ErrFirstLastNameMissing           = errors.New(FIRST_LAST_NAME_MISSING)
	ErrGinModeInvalid                 = errors.New(GIN_MODE_INVALID)
	ErrGreatThanZero                  = errors.New(GREATER_THAN_ZERO)
	ErrFirebaseProjectMissing         = errors.New(FIREBASE_GC_PROJECT_ID_MISSING)
	ErrHTTPRequestFailed              = errors.New(HTTP_REQUEST_FALIED)
	ErrHTTPSecureServerFailed         = errors.New(HTTP_SECURE_SERVER_FAILED)
	ErrJSONGenerationFailed           = errors.New(JSON_GENERATION_FAILED)
	ErrJSONInvalid                    = errors.New(JSON_INVALID)
	ErrLastNameMissing                = errors.New(LAST_NAME_MISSING)
	ErrMapIsEmpty                     = errors.New(MAP_IS_EMPTY)
	ErrMapIsMissingKey                = errors.New(MAP_MISSING_KEY)
	ErrMapIsMissingValue              = errors.New(MAP_MISSING_VALUE)
	ErrMaxThreadsInvalid              = errors.New(MAX_THREADS_INVALID)
	ErrNatsPortInvalid                = errors.New(NATS_ZERO)
	ErrMessageJSONInvalid             = errors.New(MESSAGE_JSON_INVALID)
	ErrMessageNamespaceInvalid        = errors.New(MESSAGE_NAMESPACE_INVALID)
	ErrMissingServerName              = errors.New(MISSING_SERVER_NAME)
	ErrNATSURLInvalid                 = errors.New(NATS_URL_INVALID)
	ErrNATSConnectionFailed           = errors.New(NATS_CONNECTION_FAILED)
	ErrPIDFileExists                  = errors.New(PID_FILE_EXISTS)
	ErrPlaidInvalidPublicToken        = errors.New(PLAID_INVALID_PUBLIC_TOKEN)
	ErrPointerMissing                 = errors.New(POINTER_MISSING)
	ErrPostgresSSLMode                = errors.New(POSTGRES_SSL_MODE)
	ErrPostgresConnFailed             = errors.New(POSTGRES_CONN_FALIED)
	ErrPostgresConnEmpty              = errors.New(POSTGRES_CONN_EMPTY)
	ErrRedirectModeMissing            = errors.New(REDIRECT_MODE_MISSING)
	ErrRedirectModeInvalid            = errors.New(REDIRECT_MODE_INVALID)
	ErrRefreshTooSoon                 = errors.New(REFRESH_TOO_SOON)
	ErrRequestorIdMissing             = errors.New(REQUESTOR_ID_MISSING)
	ErrRequiredArgumentMissing        = errors.New(REQUIRED_ARGUMENT_MISSING)
	ErrRequiredFileMissing            = errors.New(REQUIRED_FILE_MISSING)
	ErrRetryLimitHit                  = errors.New(RETRY_LIMIT_HIT)
	ErrServerConfigurationInvalid     = errors.New(SERVER_CONFIGURATION_INVALID)
	ErrServiceFailedAWS               = errors.New(SERVICE_FAILED_AWS)
	ErrServiceFailedFIREBASE          = errors.New(SERVICE_FAILED_FIREBASE)
	ErrServiceFailedFIRESTORE         = errors.New(SERVICE_FAILED_FIRESTORE)
	ErrServiceFailedPLAID             = errors.New(SERVICE_FAILED_PLAID)
	ErrServiceFailedPOSTGRES          = errors.New(SERVICE_FAILED_POSTGRES)
	ErrServiceFailedSendGrid          = errors.New(SERVICE_FAILED_SENDGRID)
	ErrServiceFailedSTRIPE            = errors.New(SERVICE_FAILED_STRIPE)
	ErrShortURLMissing                = errors.New(SHORT_URL_MISSING)
	ErrSignalUnknown                  = errors.New(SIGNAL_UNKNOWN)
	ErrStripeAmountInvalid            = errors.New(STRIPE_AMOUNT_INVALID)
	ErrStripeCreateCustomerFailed     = errors.New(STRIPE_CUSTOMER_FAILED)
	ErrStripeCurrencyInvalid          = errors.New(STRIPE_CURRENCY_INVALID)
	ErrStripeKeyInvalid               = errors.New(STRIPE_KEY_INVALID)
	ErrStripePaymentIntentIdEmpty     = errors.New(STRIPE_PAYMENT_INTENT_ID_EMPTY)
	ErrStripePaymentMethodEmpty       = errors.New(STRIPE_PAYMENT_METHOD_EMPTY)
	ErrStripePaymentMethodInvalid     = errors.New(STRIPE_PAYMENT_METHOD_INVALID)
	ErrStripePaymentMethodTypeEmpty   = errors.New(STRIPE_PAYMENT_METHOD_TYPE_EMPTY)
	ErrStripePaymentMethodTypeInvalid = errors.New(STRIPE_PAYMENT_METHOD_TYPE_INVALID)
	ErrStripeMethodTypeUnsupported    = errors.New(STRIPE_METHOD_TYPE_UNSUPPORTED)
	ErrStripeOneTimeCodeFailed        = errors.New(STRIPE_ONE_TIME_CODE_FAILED)
	ErrStripeOutNotSupported          = errors.New(STRIPE_OUT_NOT_SUPPORTED)
	ErrStripeSourceInvalid            = errors.New(STRIPE_SOURCE_INVALID)
	ErrStructInvalid                  = errors.New(STRUCT_INVALID)
	ErrSubjectInvalid                 = errors.New(SUBJECT_INVALID)
	ErrSubjectsMissing                = errors.New(SUBJECTS_MISSING)
	ErrSubjectSubscriptionFailed      = errors.New(SUBJECT_SUBSCRIPTION_FAILED)
	ErrTLSFilesMissing                = errors.New(TLS_FILES_MISSING)
	ErrTokenClaimsInvalid             = errors.New(TOKEN_CLAIMS_INVALID)
	ErrTokenExpired                   = errors.New(TOKEN_EXPIRED)
	ErrTokenInvalid                   = errors.New(TOKEN_INVALID)
	ErrTransferAmountInvalid          = errors.New(TRANSFER_AMOUNT_INVALID)
	ErrTransferInNotAllowed           = errors.New(TRANSFER_IN_NOT_ALLOWED)
	ErrTransferMethodInvalid          = errors.New(TRANSFER_METHOD_INVALID)
	ErrTransferOutNotAllowed          = errors.New(TRANSFER_OUT_NOT_ALLOWED)
	ErrTrueShouldBeFalse              = errors.New(TRUE_SHOULD_BE_FALSE)
	ErrUnableReadFile                 = errors.New(UNABLE_READ_FILE)
	ErrUnauthorizedRequest            = errors.New(UNAUTHORIZED_REQUEST)
	ErrUnmarshalFailed                = errors.New(UNMARSHAL_FAILED)
	ErrUnconfirmedEmail               = errors.New(UNCONFIRMED_EMAIL)
	ErrUnexpectedError                = errors.New(UNEXPECTED_ERROR)
	ErrUnsupportedTransferMethod      = errors.New(UNSUPPORTED_TRANSFER_METHOD)
	ErrUserAccountAlreadyExists       = errors.New(USER_ACCOUNT_ALREADY_EXISTS)
	ErrUserAccountMissing             = errors.New(USER_ACCOUNT_MISSING)
	ErrUserAlreadyExists              = errors.New(USER_ALREADY_EXISTS)
	ErrUserBundleAlreadyExists        = errors.New(BUNDLE_ALREADY_EXISTS)
	ErrUserBundleMissing              = errors.New(BUNDLE_MISSING)
	ErrUserMissing                    = errors.New(USER_MISSING)
	ErrVersionInvalid                 = errors.New(VERSION_INVALID)
)

Functions

func GetWorkingDirectory

func GetWorkingDirectory() (path string)

GetWorkingDirectory - return the working directory for the program

Customer Messages: None
Errors: None
Verifications: None

func PrintDebugFunctionInfo

func PrintDebugFunctionInfo(
	debugModeOn bool,
	outputMode string,
)

PrintDebugFunctionInfo - if debugMode is true the function info of the caller will be output. The format of the messages is "[DEBUG] File: {Filename} Function: {Function Name} Near Line Number: {Line Number}\n" Set shared_services.ProgramInfo.DebugModeOn to true to turn on debug mode. The default is false. This function uses the shared_services.ProgramInfo.OutputModeOn. The default is log.

Customer Messages: None
Errors: None
Verifications: None

func PrintDebugLine

func PrintDebugLine(
	message string,
	debugModeOn bool,
	outputMode string,
)

PrintDebugLine - if debugMode is true the function info of the caller will be output. The format of the messages is "[DEBUG] File: {Filename} Function: {Function Name} Near Line Number: {Line Number}\n" Set shared_services.ProgramInfo.DebugModeOn to true to turn on debug mode. The default is false. This function uses the shared_services.ProgramInfo.OutputModeOn. The default is log.

Customer Messages: None
Errors: None
Verifications: None

func PrintError

func PrintError(
	myError error,
	additionalInfo string,
)

PrintError - will output error information using this format: "ERROR {Error Message} Additional Info: '{Additional Info}' File: {Filename} Near Line Number: {Line Number}\n" If the outputMode is display, the color will be red. The default is to output to the log.

Customer Messages: None
Errors: Missing values will be filled with 'MISSING'.
Verifications: None

func PrintErrorInfo

func PrintErrorInfo(errorInfo ErrorInfo)

PrintErrorInfo - will output error information using this format: "ERROR {Error Message} Additional Info: '{Additional Info}' File: {Filename} Near Line Number: {Line Number}\n" If the outputMode is display, the color will be red. The default is to output to the log.

Customer Messages: None
Errors: ErrErrorMissing
Verifications: None

Types

type ErrorInfo

type ErrorInfo struct {
	AdditionalInfo string `json:"error_additional_info"`
	Error          error  `json:"-"`
	FileName       string `json:"error_filename"`
	FunctionName   string `json:"error_function_name"`
	LineNumber     int    `json:"error_line_number"`
	Message        string `json:"error_message"`
}

func NewErrorInfo

func NewErrorInfo(
	myError error,
	additionalInfo string,
) (errorInfo ErrorInfo)

NewErrorInfo - will return an ErrorInfo object.

Customer Messages: None
Errors: Missing values will be filled with 'MISSING'.
Verifications: None

type FunctionInfo

type FunctionInfo struct {
	FileName   string `json:"function_filename"`
	Name       string `json:"function_name"`
	LineNumber int    `json:"function_line_number"`
}

func GetFunctionInfo

func GetFunctionInfo(level int) (functionInfo FunctionInfo)

GetFunctionInfo - returns information about the function based on the level provided.

0 will always return information about GetFunctionInfo

1 will return the caller of GetFunctionInfo

2+ will return the corresponding caller back up the chain.

Customer Messages: None
Errors: None
Verifications: None

type ProgramInfo

type ProgramInfo struct {
	ErrorInfo        ErrorInfo
	FileName         string       `json:"program_filename"`
	FunctionInfo     FunctionInfo `json:"function_info"`
	GoVersion        string       `json:"go_version"`
	NumberCPUs       int          `json:"number_cpus"`
	DebugModeOn      bool         `json:"debug_mode_on"`
	WorkingDirectory string       `json:"working_directory"`
}

func GetProgramInfo

func GetProgramInfo() (programInfo ProgramInfo)

GetProgramInfo - returns information about the program and the system where it is executing. The level is set to 1, so it will always return information about the caller. It is recommended that you use this when you initialize your program.

Customer Messages: None
Errors: None
Verifications: None

Jump to

Keyboard shortcuts

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