| 566 | } |
| 567 | |
| 568 | func InterfaceToStrSlice(in interface{}) ([]string, bool) { |
| 569 | if in == nil { |
| 570 | return nil, true |
| 571 | } |
| 572 | |
| 573 | if strSlice, ok := in.([]string); ok { |
| 574 | return strSlice, true |
| 575 | } |
| 576 | |
| 577 | inSlice, ok := InterfaceToInterfaceSlice(in) |
| 578 | if !ok { |
| 579 | return nil, false |
| 580 | } |
| 581 | |
| 582 | out := make([]string, len(inSlice)) |
| 583 | |
| 584 | for i, elem := range inSlice { |
| 585 | casted, ok := elem.(string) |
| 586 | if !ok { |
| 587 | return nil, false |
| 588 | } |
| 589 | out[i] = casted |
| 590 | } |
| 591 | return out, true |
| 592 | } |
| 593 | |
| 594 | func InterfaceToBoolSlice(in interface{}) ([]bool, bool) { |
| 595 | if in == nil { |