package bgm import ( "os" "strings" ) type QueryMap map[string]string func GetEnvDefault(key, defVal string) string { val, ex := os.LookupEnv(key) if !ex { os.Setenv(key, defVal) return defVal } return val } func GetQueryMap(s string) QueryMap { m := make(map[string]string) if s != "" { s = string([]byte(s)[1 : len([]byte(s))-1]) for _, v := range strings.Split(s, ",") { split := strings.Split(v, "=") m[split[0]] = split[1] } } return m }