Added HGet to embedded API

This commit is contained in:
Kelvin Clement Mwinuka
2024-05-14 03:30:51 +08:00
parent aa7b5fa8cc
commit 7fb236e631
4 changed files with 492 additions and 452 deletions

View File

@@ -601,28 +601,31 @@ func handleHDEL(params internal.HandlerFuncParams) ([]byte, error) {
func Commands() []internal.Command {
return []internal.Command{
{
Command: "hset",
Module: constants.HashModule,
Categories: []string{constants.HashCategory, constants.WriteCategory, constants.FastCategory},
Description: `(HSET key field value [field value ...]) Set update each field of the hash with the corresponding value`,
Command: "hset",
Module: constants.HashModule,
Categories: []string{constants.HashCategory, constants.WriteCategory, constants.FastCategory},
Description: `(HSET key field value [field value ...])
Set update each field of the hash with the corresponding value.`,
Sync: true,
KeyExtractionFunc: hsetKeyFunc,
HandlerFunc: handleHSET,
},
{
Command: "hsetnx",
Module: constants.HashModule,
Categories: []string{constants.HashCategory, constants.WriteCategory, constants.FastCategory},
Description: `(HSETNX key field value [field value ...]) Set hash field value only if the field does not exist`,
Command: "hsetnx",
Module: constants.HashModule,
Categories: []string{constants.HashCategory, constants.WriteCategory, constants.FastCategory},
Description: `(HSETNX key field value [field value ...])
Set hash field value only if the field does not exist.`,
Sync: true,
KeyExtractionFunc: hsetnxKeyFunc,
HandlerFunc: handleHSET,
},
{
Command: "hget",
Module: constants.HashModule,
Categories: []string{constants.HashCategory, constants.ReadCategory, constants.FastCategory},
Description: `(HGET key field [field ...]) Retrieve the value of each of the listed fields from the hash`,
Command: "hget",
Module: constants.HashModule,
Categories: []string{constants.HashCategory, constants.ReadCategory, constants.FastCategory},
Description: `(HGET key field [field ...])
Retrieve the value of each of the listed fields from the hash.`,
Sync: false,
KeyExtractionFunc: hgetKeyFunc,
HandlerFunc: handleHGET,
@@ -632,7 +635,7 @@ func Commands() []internal.Command {
Module: constants.HashModule,
Categories: []string{constants.HashCategory, constants.ReadCategory, constants.FastCategory},
Description: `(HSTRLEN key field [field ...])
Return the string length of the values stored at the specified fields. 0 if the value does not exist`,
Return the string length of the values stored at the specified fields. 0 if the value does not exist.`,
Sync: false,
KeyExtractionFunc: hstrlenKeyFunc,
HandlerFunc: handleHSTRLEN,
@@ -650,7 +653,7 @@ Return the string length of the values stored at the specified fields. 0 if the
Command: "hrandfield",
Module: constants.HashModule,
Categories: []string{constants.HashCategory, constants.ReadCategory, constants.SlowCategory},
Description: `(HRANDFIELD key [count [WITHVALUES]]) Returns one or more random fields from the hash`,
Description: `(HRANDFIELD key [count [WITHVALUES]]) Returns one or more random fields from the hash.`,
Sync: false,
KeyExtractionFunc: hrandfieldKeyFunc,
HandlerFunc: handleHRANDFIELD,
@@ -659,7 +662,7 @@ Return the string length of the values stored at the specified fields. 0 if the
Command: "hlen",
Module: constants.HashModule,
Categories: []string{constants.HashCategory, constants.ReadCategory, constants.FastCategory},
Description: `(HLEN key) Returns the number of fields in the hash`,
Description: `(HLEN key) Returns the number of fields in the hash.`,
Sync: false,
KeyExtractionFunc: hlenKeyFunc,
HandlerFunc: handleHLEN,
@@ -668,7 +671,7 @@ Return the string length of the values stored at the specified fields. 0 if the
Command: "hkeys",
Module: constants.HashModule,
Categories: []string{constants.HashCategory, constants.ReadCategory, constants.SlowCategory},
Description: `(HKEYS key) Returns all the fields in a hash`,
Description: `(HKEYS key) Returns all the fields in a hash.`,
Sync: false,
KeyExtractionFunc: hkeysKeyFunc,
HandlerFunc: handleHKEYS,
@@ -677,7 +680,7 @@ Return the string length of the values stored at the specified fields. 0 if the
Command: "hincrbyfloat",
Module: constants.HashModule,
Categories: []string{constants.HashCategory, constants.WriteCategory, constants.FastCategory},
Description: `(HINCRBYFLOAT key field increment) Increment the hash value by the float increment`,
Description: `(HINCRBYFLOAT key field increment) Increment the hash value by the float increment.`,
Sync: true,
KeyExtractionFunc: hincrbyKeyFunc,
HandlerFunc: handleHINCRBY,
@@ -695,7 +698,7 @@ Return the string length of the values stored at the specified fields. 0 if the
Command: "hgetall",
Module: constants.HashModule,
Categories: []string{constants.HashCategory, constants.ReadCategory, constants.SlowCategory},
Description: `(HGETALL key) Get all fields and values of a hash`,
Description: `(HGETALL key) Get all fields and values of a hash.`,
Sync: false,
KeyExtractionFunc: hgetallKeyFunc,
HandlerFunc: handleHGETALL,
@@ -704,7 +707,7 @@ Return the string length of the values stored at the specified fields. 0 if the
Command: "hexists",
Module: constants.HashModule,
Categories: []string{constants.HashCategory, constants.ReadCategory, constants.FastCategory},
Description: `(HEXISTS key field) Returns if field is an existing field in the hash`,
Description: `(HEXISTS key field) Returns if field is an existing field in the hash.`,
Sync: false,
KeyExtractionFunc: hexistsKeyFunc,
HandlerFunc: handleHEXISTS,
@@ -712,8 +715,8 @@ Return the string length of the values stored at the specified fields. 0 if the
{
Command: "hdel",
Module: constants.HashModule,
Categories: []string{constants.HashCategory, constants.ReadCategory, constants.FastCategory},
Description: `(HDEL key field [field ...]) Deletes the specified fields from the hash`,
Categories: []string{constants.HashCategory, constants.WriteCategory, constants.FastCategory},
Description: `(HDEL key field [field ...]) Deletes the specified fields from the hash.`,
Sync: true,
KeyExtractionFunc: hdelKeyFunc,
HandlerFunc: handleHDEL,