Skip to main content

HSET

Syntax

HSET key field value [field value ...]

Module

hash

Categories

fast hash write

Description

Update each field of the hash with the corresponding value. If the field does not exist, it is created.

Examples

Update each field of the hash with the corresponding value:

db, err := sugardb.NewSugarDB()
if err != nil {
log.Fatal(err)
}
noOfUpdatedFields, err := db.HSet("key", map[string]string{"field1": "value1", "field2": "value2"})