Documentation
¶
Index ¶
- Variables
- func ErrorArrayToStringArray(errorArray *[]error) *[]string
- func PrettyDuration(d time.Duration, minUnit string) (string, error)
- func ToBool(value string, dest interface{}) error
- func ToFloat32(value string, dest interface{}) error
- func ToFloat64(value string, dest interface{}) error
- func ToInt(value string, dest interface{}) error
- func ToInt16(value string, dest interface{}) error
- func ToInt32(value string, dest interface{}) error
- func ToInt64(value string, dest interface{}) error
- func ToInt8(value string, dest interface{}) error
- func ToString(value string, dest interface{}) error
- func ToUint(value string, dest interface{}) error
- func ToUint16(value string, dest interface{}) error
- func ToUint32(value string, dest interface{}) error
- func ToUint64(value string, dest interface{}) error
- func ToUint8(value string, dest interface{}) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidDestinationType = "invalid destination type, expected: '%s'" ErrParseIntFailed = "cannot parse '%s', expected integer" ErrParseInt8Failed = "cannot parse '%s', expected integer of 8 bits" ErrParseInt16Failed = "cannot parse '%s', expected integer of 16 bits" ErrParseInt32Failed = "cannot parse '%s', expected integer of 32 bits" ErrParseInt64Failed = "cannot parse '%s', expected integer of 64 bits" ErrParseUintFailed = "cannot parse '%s', expected unsigned integer" ErrParseUint8Failed = "cannot parse '%s', expected unsigned integer of 8 bits" ErrParseUint16Failed = "cannot parse '%s', expected unsigned integer of 16 bits" ErrParseUint32Failed = "cannot parse '%s', expected unsigned integer of 32 bits" ErrParseUint64Failed = "cannot parse '%s', expected unsigned integer of 64 bits" ErrParseFloat32Failed = "cannot parse '%s', expected float of 32 bits" ErrParseFloat64Failed = "cannot parse '%s', expected float of 64 bits" ErrParseBoolFailed = "cannot parse '%s', expected boolean" ErrInvalidDurationUnit = "invalid duration unit, expected: '%s'" )
Functions ¶
func ErrorArrayToStringArray ¶
ErrorArrayToStringArray maps an array of errors to an array of strings.
Parameters:
errorArray - pointer to a slice of errors to convert
Returns:
Pointer to a slice of strings containing the error messages, or nil if input is nil or empty.
func PrettyDuration ¶ added in v0.1.10
PrettyDuration formats a duration as a human-readable string, omitting zero-value units.
Parameters:
d - the duration to format minUnit - the minimum unit to include (one of "ns", "us", "ms", "s", "m", "h", "d")
Returns:
A formatted string representing the duration, and an error if minUnit is invalid.
func ToBool ¶ added in v0.1.2
ToBool sets the destination to the value of the string as a bool.
Parameters:
value - the string to convert dest - pointer to a bool where the result will be stored
Returns:
An error if the conversion fails or the destination is not a pointer to bool.
func ToFloat32 ¶ added in v0.1.2
ToFloat32 sets the destination to the value of the string as a float32.
Parameters:
value - the string to convert dest - pointer to a float32 where the result will be stored
Returns:
An error if the conversion fails or the destination is not a pointer to float32.
func ToFloat64 ¶ added in v0.1.2
ToFloat64 sets the destination to the value of the string as a float64.
Parameters:
value - the string to convert dest - pointer to a float64 where the result will be stored
Returns:
An error if the conversion fails or the destination is not a pointer to float64.
func ToInt ¶ added in v0.1.2
ToInt sets the destination to the value of the string as an int.
Parameters:
value - the string to convert dest - pointer to an int where the result will be stored
Returns:
An error if the conversion fails or the destination is not a pointer to int.
func ToInt16 ¶ added in v0.1.2
ToInt16 sets the destination to the value of the string as an int16.
Parameters:
value - the string to convert dest - pointer to an int16 where the result will be stored
Returns:
An error if the conversion fails or the destination is not a pointer to int16.
func ToInt32 ¶ added in v0.1.2
ToInt32 sets the destination to the value of the string as an int32.
Parameters:
value - the string to convert dest - pointer to an int32 where the result will be stored
Returns:
An error if the conversion fails or the destination is not a pointer to int32.
func ToInt64 ¶ added in v0.1.2
ToInt64 sets the destination to the value of the string as an int64.
Parameters:
value - the string to convert dest - pointer to an int64 where the result will be stored
Returns:
An error if the conversion fails or the destination is not a pointer to int64.
func ToInt8 ¶ added in v0.1.2
ToInt8 sets the destination to the value of the string as an int8.
Parameters:
value - the string to convert dest - pointer to an int8 where the result will be stored
Returns:
An error if the conversion fails or the destination is not a pointer to int8.
func ToString ¶ added in v0.1.8
ToString sets the destination to the value of the string.
Parameters:
value - the string to assign dest - pointer to a string where the value will be stored
Returns:
An error if the destination is not a pointer to string.
func ToUint ¶ added in v0.1.2
ToUint sets the destination to the value of the string as a uint.
Parameters:
value - the string to convert dest - pointer to a uint where the result will be stored
Returns:
An error if the conversion fails or the destination is not a pointer to uint.
func ToUint16 ¶ added in v0.1.2
ToUint16 sets the destination to the value of the string as a uint16.
Parameters:
value - the string to convert dest - pointer to a uint16 where the result will be stored
Returns:
An error if the conversion fails or the destination is not a pointer to uint16.
func ToUint32 ¶ added in v0.1.2
ToUint32 sets the destination to the value of the string as a uint32.
Parameters:
value - the string to convert dest - pointer to a uint32 where the result will be stored
Returns:
An error if the conversion fails or the destination is not a pointer to uint32.
func ToUint64 ¶ added in v0.1.2
ToUint64 sets the destination to the value of the string as a uint64.
Parameters:
value - the string to convert dest - pointer to a uint64 where the result will be stored
Returns:
An error if the conversion fails or the destination is not a pointer to uint64.
Types ¶
This section is empty.