MCPcopy Create free account
hub / github.com/ByteStorage/FlyDB / HGetAllFieldAndValue

Method HGetAllFieldAndValue

structure/hash.go:1242–1256  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
1242func (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//

Callers 2

SizeMethod · 0.95

Calls 2

GetFieldsMethod · 0.95
HGetMethod · 0.95

Tested by 1