MCPcopy
hub / github.com/mitchellh/mapstructure / isEmptyValue

Function isEmptyValue

mapstructure.go:1484–1500  ·  view source on GitHub ↗
(v reflect.Value)

Source from the content-addressed store, hash-verified

1482}
1483
1484func isEmptyValue(v reflect.Value) bool {
1485 switch getKind(v) {
1486 case reflect.Array, reflect.Map, reflect.Slice, reflect.String:
1487 return v.Len() == 0
1488 case reflect.Bool:
1489 return !v.Bool()
1490 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
1491 return v.Int() == 0
1492 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
1493 return v.Uint() == 0
1494 case reflect.Float32, reflect.Float64:
1495 return v.Float() == 0
1496 case reflect.Interface, reflect.Ptr:
1497 return v.IsNil()
1498 }
1499 return false
1500}
1501
1502func getKind(val reflect.Value) reflect.Kind {
1503 kind := val.Kind()

Callers 1

decodeMapFromStructMethod · 0.85

Calls 1

getKindFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…