Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrintError ¶
PrintError formats and prints an error message to standard output. @param {string} message - A string representing the error message to display. @param {Error} err - An error object providing more information about the error. The function formats the error message with the provided message and error object, then prints it to the console with a bold "ERROR:" label using ANSI escape codes. @returns {void}
func PrintToDo ¶ added in v0.0.13
func PrintToDo(message ...interface{})
PrintToDo formats and prints a to-do message to standard output.
@param {interface{}} message - An array of any type that forms the to-do message to display.
The function checks each element in the message. If it is a time.Time type, it is formatted according to RFC3339. All elements are then converted into their string representations, concatenated into a single string, then formatted and printed the string to the console with a bold "TODO:" label using ANSI escape codes.
@returns {void}
func ValidateEmailRegex ¶ added in v0.3.0
ValidateEmailRegex checks if the provided email string matches the regex for a valid email address. @param {string} email - The email address to validate. @returns {bool} - True if the email is valid, false otherwise.
Types ¶
type Event ¶ added in v0.0.8
type Event struct {
// contains filtered or unexported fields
}
Event is a simple event system that allows multiple listeners to subscribe and receive notifications when an event is emitted. @typedef {Object} Event @property {Array<Function>} listeners - An array of listener functions to be called when the event is emitted. @property {sync.Mutex} lock - A mutex used for ensuring thread-safety when modifying the listeners array or emitting events.
func (*Event) Emit ¶ added in v0.0.8
func (e *Event) Emit(data interface{})
Emit triggers the event, notifying all subscribed listeners with the provided data. @method @memberof Event @param {interface{}} data - The data to be passed to each listener when the event is emitted. @returns {void}
func (*Event) Subscribe ¶ added in v0.0.8
func (e *Event) Subscribe(listener func(interface{}))
Subscribe adds a listener function to the Event object. @method @memberof Event @param {Function} listener - A function to be called when the event is emitted. It takes a single argument, which is the data passed when emitting the event. @returns {void}
type MessengerUtils ¶
type MessengerUtils struct {
Verbose bool
}
func (*MessengerUtils) PrintInfo ¶
func (m *MessengerUtils) PrintInfo(message ...interface{})
PrintInfo prints the provided message to the console with the prefix "INFO" in bold, if the MessengerUtils's verbose flag is set to true. The function accepts a variadic string parameter and concatenates all strings before printing. @param {string} message - One or more strings to print as the message. @returns {void}