feat: and 查询
This commit is contained in:
+18
-1
@@ -1,6 +1,11 @@
|
||||
package bgm
|
||||
|
||||
import "os"
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type QueryMap map[string]string
|
||||
|
||||
func GetEnvDefault(key, defVal string) string {
|
||||
val, ex := os.LookupEnv(key)
|
||||
@@ -10,3 +15,15 @@ func GetEnvDefault(key, defVal string) string {
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user