func ToStrings(slice interface{}, fieldName string) (s []string, err error) {
	switch reflect.TypeOf(slice).Kind() {
	case reflect.Slice:
		val := reflect.ValueOf(slice)
		for i := 0; i < val.Len(); i++ {
			fields := structs.Fields(val.Index(i).Interface())
			for _, f := range fields {
				if f.IsExported() && f.Name() == fieldName {
					e := f.Value()
					switch e.(type) {
					case string:
						s = append(s, e.(string))
					default:
						return nil, ErrNotString
					}
				}
			}
		}
	default:
		return nil, ErrNotSlice
	}
	return
}
ToStrings maps a field to a slice of string.
package slices
import (
	"reflect"
	"github.com/fatih/structs"
	"github.com/pkg/errors"
)
var (
	ErrNotSlice = errors.New("not slice")
	ErrNotString = errors.New("not string")
	ErrNotInt = errors.New("not int")
	ErrNotFloat = errors.New("not float64")
	ErrNotBool = errors.New("not bool")
)
func IndexOf(val interface{}, slice interface{}) int {
	v := reflect.ValueOf(val)
	arr := reflect.ValueOf(slice)
	t := reflect.TypeOf(slice).Kind()
	if t != reflect.Slice && t != reflect.Array {
		panic("Type Error! Second argument must be an array or a slice.")
	}
	for i := 0; i < arr.Len(); i++ {
		if arr.Index(i).Interface() == v.Interface() {
			return i
		}
	}
	return -1
}