HSETNX
Syntax
HSETNX key field value [field value ...]
Module
hashCategories
fast hash writeDescription
Set hash field value only if the field does not exist.
Examples
- Go (Embedded)
- CLI
Set hash field value:
db, err := sugardb.NewSugarDB()
if err != nil {
log.Fatal(err)
}
noOfUpdatedFields, err := db.HSetNX("key", map[string]string{"field1": "value1", "field2": "value2"})
Set hash field value:
> HSETNX key field1 value1 field2 value2