Skip to main content

HRANDFIELD

Syntax

HRANDFIELD key [count [WITHVALUES]]

Module

hash

Categories

hash read slow

Description

Returns one or more random fields from the hash.

Options

  • WITHVALUES - When provided, the return value will contain the field and its value. Otherwise, only the field is returned.

Examples

Returns one or more random fields from the hash:

vault, err := echovault.NewEchoVault()
if err != nil {
log.Fatal(err)
}
fields, err := vault.HRandField("key", echovault.HRandFieldOptions{})