support push item choice

This commit is contained in:
akrike
2025-02-09 13:13:17 +08:00
parent ed90f6b31f
commit 81351a815f
4 changed files with 14 additions and 6 deletions

View File

@@ -1,6 +1,7 @@
package utils
import (
"encoding/json"
"fmt"
"math/rand"
"regexp"
@@ -76,3 +77,9 @@ func (k *KVStr) Build() string {
}
return strings.Join(strList, " , ")
}
func JsonStrToStruct[T any](str string) T {
var data T
json.Unmarshal([]byte(str), &data)
return data
}