cast icon indicating copy to clipboard operation
cast copied to clipboard

safe and easy casting from one type to another in Go

Results 110 cast issues
Sort by recently updated
recently updated
newest added

StringMapE adapt to arrays

invalid syntax, returned 0 But the correct one is to return 8 ![castError](https://user-images.githubusercontent.com/15866419/176153549-7620baa2-29b6-4e80-bd90-025bd62a403b.png)

This PR adds support for a string to int slice conversion. The supported format is a space separated list of ints encoded as a string. An use case for this...

When we use Nullable(XXX), the default return is not what I want. If Float64 is passed null, I want to store it to null .

This fixes issue https://github.com/spf13/cast/issues/143.

``` ... inValue = "18446744073709551615" log.Printf("inValue = %v", inValue ) outValue := cast.ToUint64(inValue ) log.Printf("outValue = %v", outValue ) ... ``` Result for v1.4.1: ``` INFO[2022-06-06T14:01:00+03:00] inValue = 18446744073709551615 INFO[2022-06-06T14:01:00+03:00]...

Reason: 1. Be consistent with other int type

There was an error converting varchar data from Mysql to Int64

As title said, when you transform int16, int64 or other digital type (not int) to bool, return an error result. ```go func try() { var i int64 = 1 fmt.Println(cast.ToBool(i))...

I find it weird for function converting ToBool to work with int but unable to convert int64, so I think we should add some more. Types added: - int8 -...