Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertIfZero ¶
AssertIfZero panics if the element is zero.
Parameters:
- elem: The element to check.
- msg: The message to show if the element is zero.
The panic message is the string msg.
Types ¶
type ErrEmpty ¶
type ErrEmpty[T any] struct { // Value is the value that caused the error. Value T }
ErrEmpty represents an error when a value is empty.
func NewErrEmpty ¶
NewErrEmpty creates a new ErrEmpty error.
Parameters:
- value: The value that caused the error.
Returns:
- *ErrEmpty: A pointer to the newly created ErrEmpty.
type ErrInvalidCall ¶
type ErrInvalidCall struct {
// FnName is the name of the function.
FnName string
// Signature is the Signature of the function.
Signature reflect.Type
// Reason is the Reason for the failure.
Reason error
}
ErrInvalidCall represents an error that occurs when a function is not called correctly.
func NewErrInvalidCall ¶
func NewErrInvalidCall(functionName string, function any, reason error) *ErrInvalidCall
NewErrInvalidCall creates a new ErrInvalidCall.
Parameters:
- functionName: The name of the function.
- function: The function that failed.
- reason: The reason for the failure.
Returns:
- *ErrInvalidCall: A pointer to the new ErrInvalidCall.
func (*ErrInvalidCall) ChangeReason ¶
func (e *ErrInvalidCall) ChangeReason(reason error)
ChangeReason implements the Unwrapper interface.
func (*ErrInvalidCall) Error ¶
func (e *ErrInvalidCall) Error() string
Error implements the Unwrapper interface.
Message: "call to {function}({signature}) failed: {reason}".
However, if the reason is nil, the message is "call to {function}({signature}) failed" instead.
func (*ErrInvalidCall) Unwrap ¶
func (e *ErrInvalidCall) Unwrap() error
Unwrap implements the Unwrapper interface.
type FunctionCall ¶
type FunctionCall struct {
// Call is the string representation of the function call.
Call string
// Dependencies are the dependencies of the function call.
Dependencies []string
}
FunctionCall represents a function call.
func GetStringOf ¶
func GetStringOf(type_name string, elem any, custom map[string][]string) FunctionCall
GetStringOf returns the string function call for the given element.
Parameters:
- type_name: The name of the type.
- elem: The element to get the string of.
- custom: The custom strings to use. Empty values are ignored.
Returns:
- FunctionCall: The function call.
func NewFunctionCall ¶
func NewFunctionCall(call string, dependencies []string) FunctionCall