mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-01 07:35:58 +08:00
CreateGroup
This commit is contained in:
@@ -205,6 +205,18 @@ func GetUserInfoFromCache(userID string) (*imdb.User, error) {
|
||||
return userInfo, utils.Wrap(err, "")
|
||||
}
|
||||
|
||||
func GetUserInfoFromCacheBatch(userIDs []string) ([]*imdb.User, error) {
|
||||
var users []*imdb.User
|
||||
for _, userID := range userIDs {
|
||||
user, err := GetUserInfoFromCache(userID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
users = append(users, user)
|
||||
}
|
||||
return users, nil
|
||||
}
|
||||
|
||||
func DelUserInfoFromCache(userID string) error {
|
||||
return db.DB.Rc.TagAsDeleted(userInfoCache + userID)
|
||||
}
|
||||
|
||||
+13
-2
@@ -37,7 +37,7 @@ func Uint32ToString(i uint32) string {
|
||||
return strconv.FormatInt(int64(i), 10)
|
||||
}
|
||||
|
||||
//judge a string whether in the string list
|
||||
// judge a string whether in the string list
|
||||
func IsContain(target string, List []string) bool {
|
||||
for _, element := range List {
|
||||
|
||||
@@ -80,7 +80,7 @@ func StructToJsonBytes(param interface{}) []byte {
|
||||
return dataType
|
||||
}
|
||||
|
||||
//The incoming parameter must be a pointer
|
||||
// The incoming parameter must be a pointer
|
||||
func JsonStringToStruct(s string, args interface{}) error {
|
||||
err := json.Unmarshal([]byte(s), args)
|
||||
return err
|
||||
@@ -121,3 +121,14 @@ func RemoveDuplicateElement(idList []string) []string {
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func IsRepeatStringSlice(arr []string) bool {
|
||||
t := make(map[string]struct{})
|
||||
for _, s := range arr {
|
||||
if _, ok := t[s]; ok {
|
||||
return true
|
||||
}
|
||||
t[s] = struct{}{}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user