changed types to unexoprted

This commit is contained in:
Yan Mikhailov 2019-03-19 14:06:03 +02:00
parent b0445ca892
commit a4d8cc2a71
2 changed files with 9 additions and 9 deletions

View File

@ -132,7 +132,7 @@ func ToFloat64E(i interface{}) (float64, error) {
return 1, nil return 1, nil
} }
return 0, nil return 0, nil
case Float64er: case float64er:
v, err := s.Float64() v, err := s.Float64()
if err != nil { if err != nil {
return 0, fmt.Errorf("unable to cast %#v of type %T to float64", i, i) return 0, fmt.Errorf("unable to cast %#v of type %T to float64", i, i)
@ -183,7 +183,7 @@ func ToFloat32E(i interface{}) (float32, error) {
return 1, nil return 1, nil
} }
return 0, nil return 0, nil
case Float64er: case float64er:
v, err := s.Float64() v, err := s.Float64()
if err != nil { if err != nil {
return 0, fmt.Errorf("unable to cast %#v of type %T to float32", i, i) return 0, fmt.Errorf("unable to cast %#v of type %T to float32", i, i)
@ -239,7 +239,7 @@ func ToInt64E(i interface{}) (int64, error) {
return 0, nil return 0, nil
case nil: case nil:
return 0, nil return 0, nil
case Int64er: case int64er:
v, err := s.Int64() v, err := s.Int64()
if err != nil { if err != nil {
return 0, fmt.Errorf("unable to cast %#v of type %T to int64", i, i) return 0, fmt.Errorf("unable to cast %#v of type %T to int64", i, i)
@ -292,7 +292,7 @@ func ToInt32E(i interface{}) (int32, error) {
return 0, nil return 0, nil
case nil: case nil:
return 0, nil return 0, nil
case Int64er: case int64er:
v, err := s.Int64() v, err := s.Int64()
if err != nil { if err != nil {
return 0, fmt.Errorf("unable to cast %#v of type %T to int32", i, i) return 0, fmt.Errorf("unable to cast %#v of type %T to int32", i, i)
@ -348,7 +348,7 @@ func ToInt16E(i interface{}) (int16, error) {
return 0, nil return 0, nil
case nil: case nil:
return 0, nil return 0, nil
case Int64er: case int64er:
v, err := s.Int64() v, err := s.Int64()
if err != nil { if err != nil {
return 0, fmt.Errorf("unable to cast %#v of type %T to int16", i, i) return 0, fmt.Errorf("unable to cast %#v of type %T to int16", i, i)
@ -404,7 +404,7 @@ func ToInt8E(i interface{}) (int8, error) {
return 0, nil return 0, nil
case nil: case nil:
return 0, nil return 0, nil
case Int64er: case int64er:
v, err := s.Int64() v, err := s.Int64()
if err != nil { if err != nil {
return 0, fmt.Errorf("unable to cast %#v of type %T to int8", i, i) return 0, fmt.Errorf("unable to cast %#v of type %T to int8", i, i)
@ -460,7 +460,7 @@ func ToIntE(i interface{}) (int, error) {
return 0, nil return 0, nil
case nil: case nil:
return 0, nil return 0, nil
case Int64er: case int64er:
v, err := s.Int64() v, err := s.Int64()
if err != nil { if err != nil {
return 0, fmt.Errorf("unable to cast %#v of type %T to int", i, i) return 0, fmt.Errorf("unable to cast %#v of type %T to int", i, i)

View File

@ -1,11 +1,11 @@
package cast package cast
type ( type (
Float64er interface { float64er interface {
Float64() (float64, error) Float64() (float64, error)
} }
Int64er interface { int64er interface {
Int64() (int64, error) Int64() (int64, error)
} }
) )