IsNil checks if an input is nil
(i interface{})
| 333 | |
| 334 | // IsNil checks if an input is nil |
| 335 | func IsNil(i interface{}) bool { |
| 336 | if i == nil { |
| 337 | return true |
| 338 | } |
| 339 | switch reflect.TypeOf(i).Kind() { |
| 340 | case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: |
| 341 | return reflect.ValueOf(i).IsNil() |
| 342 | case reflect.Array: |
| 343 | return reflect.ValueOf(i).IsZero() |
| 344 | } |
| 345 | return false |
| 346 | } |
| 347 | |
| 348 | type MappedNullable interface { |
| 349 | ToMap() (map[string]interface{}, error) |
no test coverage detected