func ToURLParam(filter map[string][]string) (string, error) {
	if len(filter) == 0 {
		return "", nil
	}
	rawdata, err := json.Marshal(filter)
	if err != nil {
		return "", fmt.Errorf("failed to marshal filter params %v", filter)
	}
	return string(rawdata), nil
}
ToURLParam marshals filter as a string, used for url query
package filters
import (
	"encoding/json"
	"fmt"
	"strings"
)
var acceptedFilters = map[string]bool{
	"id":     true,
	"label":  true,
	"name":   true,
	"status": true,
}
func getAcceptKeys() (list []string) {
	for key := range acceptedFilters {
		list = append(list, key)
	}
	return
}
func Parse(filter []string) (map[string][]string, error) {
	if len(filter) == 0 {
		return nil, nil
	}
	parsed := make(map[string][]string)
	for _, str := range filter {
		splits := strings.SplitN(str, "=", 2)
		if len(splits) != 2 {
			return nil, fmt.Errorf("Bad format of filter, expected name=value")
		}
		name := splits[0]
		if _, ok := acceptedFilters[name]; !ok {
			return nil, fmt.Errorf("Invalid filter %s, accepted filter key: %v", name, getAcceptKeys())
		}
		if v, exist := parsed[name]; exist {
			v = append(v, strings.TrimSpace(splits[1]))
		} else {
			parsed[name] = []string{strings.TrimSpace(splits[1])}
		}
	}
	return parsed, nil
}