HGetAllFieldAndValue returns all fields and values of the hash stored at the specified key. It takes a string key 'k' and returns a map of strings representing the field names and their values and any possible error. Parameters: k: The key of the hash table. Returns: map[string]interface{}: A m
(key string)
| 1240 | // map[string]interface{}: A map of field names and their values. |
| 1241 | // error: An error if occurred during the operation, or nil on success. |
| 1242 | func (hs *HashStructure) HGetAllFieldAndValue(key string) (map[string]interface{}, error) { |
| 1243 | fields := hs.GetFields(key) |
| 1244 | |
| 1245 | filedAndValue := make(map[string]interface{}, 0) |
| 1246 | |
| 1247 | for _, field := range fields { |
| 1248 | v, err := hs.HGet(key, field) |
| 1249 | if err != nil { |
| 1250 | return nil, err |
| 1251 | } |
| 1252 | filedAndValue[field] = v |
| 1253 | } |
| 1254 | |
| 1255 | return filedAndValue, nil |
| 1256 | } |
| 1257 | |
| 1258 | // keysIdentify checks if the key has the identifier suffix |
| 1259 | // |