Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetOrdinalSuffix ¶
GetOrdinalSuffix returns the ordinal suffix for a given integer.
Parameters:
- number: The integer for which to get the ordinal suffix. Negative numbers are treated as positive.
Returns:
- string: The ordinal suffix for the number.
Example:
- GetOrdinalSuffix(1) returns "1st"
- GetOrdinalSuffix(2) returns "2nd"
Types ¶
type ErrAt ¶
type ErrAt struct {
// Index is the index where the error occurred.
Index int
// Name is the name of the index.
Name string
// Reason is the reason for the error.
Reason error
}
ErrAt represents an error that occurs at a specific index.
func NewErrAt ¶
NewErrAt creates a new ErrAt error.
Parameters:
- index: The index where the error occurred.
- name: The name of the index.
- reason: The reason for the error.
Returns:
- *ErrAt: A pointer to the newly created ErrAt.
func (*ErrAt) ChangeReason ¶
ChangeReason implements the Unwrapper interface.
type ErrWhileAt ¶
type ErrWhileAt struct {
// Index is the index where the error occurred.
Index int
// Element is the element where the index is pointing to.
Element string
// Operation is the operation that was being performed.
Operation string
// Reason is the reason for the error.
Reason error
}
ErrWhileAt represents an error that occurs while performing an operation at a specific index.
func NewErrWhileAt ¶
func NewErrWhileAt(operation string, index int, elem string, reason error) *ErrWhileAt
NewErrWhileAt creates a new ErrWhileAt error.
Parameters:
- operation: The operation that was being performed.
- index: The index where the error occurred.
- elem: The element where the index is pointing to.
- reason: The reason for the error.
Returns:
- *ErrWhileAt: A pointer to the newly created ErrWhileAt.
func (*ErrWhileAt) ChangeReason ¶
func (e *ErrWhileAt) ChangeReason(reason error)
ChangeReason implements the Unwrapper interface.
func (*ErrWhileAt) Error ¶
func (e *ErrWhileAt) Error() string
Error implements the Unwrapper interface.
Message: "an error occurred while {operation} at index {index} {element}: {reason}"
However, if the reason is nil, the message is "an error occurred while {operation} at index {index} {element}" instead.
func (*ErrWhileAt) Unwrap ¶
func (e *ErrWhileAt) Unwrap() error
Unwrap implements the Unwrapper interface.