func StyleParam(style string, explode bool, paramName string, value interface{}) (string, error) {
	t := reflect.TypeOf(value)
	v := reflect.ValueOf(value)
	if t.Kind() == reflect.Ptr {
		if v.IsNil() {
			return "", fmt.Errorf("value is a nil pointer")
		}
		v = reflect.Indirect(v)
		t = v.Type()
	}
	switch t.Kind() {
	case reflect.Slice:
		n := v.Len()
		sliceVal := make([]interface{}, n)
		for i := 0; i < n; i++ {
			sliceVal[i] = v.Index(i).Interface()
		}
		return styleSlice(style, explode, paramName, sliceVal)
	case reflect.Struct:
		return styleStruct(style, explode, paramName, value)
	case reflect.Map:
		return styleMap(style, explode, paramName, value)
	default:
		return stylePrimitive(style, explode, paramName, value)
	}
}
Given an input value, such as a primitive type, array or object, turn it
into a parameter based on style/explode definition.
package runtime
import (
	"fmt"
	"net/url"
	"reflect"
	"sort"
	"strconv"
	"strings"
	"time"
	"github.com/pkg/errors"
)