Conversion
The Conversion registry includes a collection of functions designed to convert one data type to another directly within your templates. This allows for seamless type transformations.
Last updated
The Conversion registry includes a collection of functions designed to convert one data type to another directly within your templates. This allows for seamless type transformations.
Last updated
toBool converts a value from any types reasonably be converted to a boolean value. Using the package.
Signature
toInt converts a value into an int
. Using the package.
Signature
Signature
Signature
Signature
Signature
toOctal parses a value as an octal (base 8) integer.
Signature
toString converts a value to a string, handling various types effectively.
Signature
toDate converts a string to a time.Time
object based on a format specification.
Signature
This example will takes the "2024-05-10"
string and convert it with the layout "2006-01-02"
.
toLocalDate converts a string to a time.Time object based on a format specification and the local timezone.
Signature
toDuration converts a value to a time.Duration
. Taking a possibly signed sequence of decimal numbers, each optional fraction and a unit suffix, such 300ms
, -1.5h
or 2h45m
.
Valid time units are ns
, us
(or µs
), ms
, s
, m
and h
.
Signature
toInt64 converts a value into an int64
. Using the package.
toUint converts a value into a uint
. Utilizes the package for conversion.
toUint64 converts a value into a uint64
. Utilizes the package for conversion.
toFloat64 converts a value into a float64. Utilizes the package for conversion.
See more about Golang Layout on the .
See more about Golang Layout on the .
[DEPRECATED] Use instead.
No error handling
[DEPRECATED] Use instead.
[DEPRECATED] Use instead.
[DEPRECATED] Use instead.