Convert types using Cast
masterCast provides a library for consistent and safe type conversion in Go, particularly useful when working with interface{} or dynamic data from formats like YAML, TOML, or JSON.
There are two patterns of conversion methods available:
To[Type]methods: These always return the desired type. If the input cannot be converted, the zero value for that type (e.g.,0,"", ornil) is returned.To[Type]Emethods: These return the converted value and anerror. This allows you to distinguish between a successful conversion to a zero value and a failed conversion.