mirror of
https://github.com/EchoVault/SugarDB.git
synced 2025-10-16 04:50:45 +08:00
Extend SugarDB Commands Using Lua Scripts (#155)
* Extend SugarDB by creating new commands using Lua - @kelvinmwinuka
This commit is contained in:
@@ -838,6 +838,7 @@ func Commands() []internal.Command {
|
||||
Description: `(HSET key field value [field value ...])
|
||||
Set update each field of the hash with the corresponding value.`,
|
||||
Sync: true,
|
||||
Type: "BUILT_IN",
|
||||
KeyExtractionFunc: hsetKeyFunc,
|
||||
HandlerFunc: handleHSET,
|
||||
},
|
||||
@@ -848,6 +849,7 @@ Set update each field of the hash with the corresponding value.`,
|
||||
Description: `(HSETNX key field value [field value ...])
|
||||
Set hash field value only if the field does not exist.`,
|
||||
Sync: true,
|
||||
Type: "BUILT_IN",
|
||||
KeyExtractionFunc: hsetnxKeyFunc,
|
||||
HandlerFunc: handleHSET,
|
||||
},
|
||||
@@ -858,6 +860,7 @@ Set hash field value only if the field does not exist.`,
|
||||
Description: `(HGET key field [field ...])
|
||||
Retrieve the value of each of the listed fields from the hash.`,
|
||||
Sync: false,
|
||||
Type: "BUILT_IN",
|
||||
KeyExtractionFunc: hgetKeyFunc,
|
||||
HandlerFunc: handleHGET,
|
||||
},
|
||||
@@ -868,6 +871,7 @@ Retrieve the value of each of the listed fields from the hash.`,
|
||||
Description: `(HMGET key field [field ...])
|
||||
Retrieve the value of each of the listed fields from the hash.`,
|
||||
Sync: false,
|
||||
Type: "BUILT_IN",
|
||||
KeyExtractionFunc: hmgetKeyFunc,
|
||||
HandlerFunc: handleHMGET,
|
||||
},
|
||||
@@ -878,6 +882,7 @@ Retrieve the value of each of the listed fields from the hash.`,
|
||||
Description: `(HSTRLEN key field [field ...])
|
||||
Return the string length of the values stored at the specified fields. 0 if the value does not exist.`,
|
||||
Sync: false,
|
||||
Type: "BUILT_IN",
|
||||
KeyExtractionFunc: hstrlenKeyFunc,
|
||||
HandlerFunc: handleHSTRLEN,
|
||||
},
|
||||
@@ -887,6 +892,7 @@ Return the string length of the values stored at the specified fields. 0 if the
|
||||
Categories: []string{constants.HashCategory, constants.ReadCategory, constants.SlowCategory},
|
||||
Description: `(HVALS key) Returns all the values of the hash at key.`,
|
||||
Sync: false,
|
||||
Type: "BUILT_IN",
|
||||
KeyExtractionFunc: hvalsKeyFunc,
|
||||
HandlerFunc: handleHVALS,
|
||||
},
|
||||
@@ -896,6 +902,7 @@ Return the string length of the values stored at the specified fields. 0 if the
|
||||
Categories: []string{constants.HashCategory, constants.ReadCategory, constants.SlowCategory},
|
||||
Description: `(HRANDFIELD key [count [WITHVALUES]]) Returns one or more random fields from the hash.`,
|
||||
Sync: false,
|
||||
Type: "BUILT_IN",
|
||||
KeyExtractionFunc: hrandfieldKeyFunc,
|
||||
HandlerFunc: handleHRANDFIELD,
|
||||
},
|
||||
@@ -905,6 +912,7 @@ Return the string length of the values stored at the specified fields. 0 if the
|
||||
Categories: []string{constants.HashCategory, constants.ReadCategory, constants.FastCategory},
|
||||
Description: `(HLEN key) Returns the number of fields in the hash.`,
|
||||
Sync: false,
|
||||
Type: "BUILT_IN",
|
||||
KeyExtractionFunc: hlenKeyFunc,
|
||||
HandlerFunc: handleHLEN,
|
||||
},
|
||||
@@ -914,6 +922,7 @@ Return the string length of the values stored at the specified fields. 0 if the
|
||||
Categories: []string{constants.HashCategory, constants.ReadCategory, constants.SlowCategory},
|
||||
Description: `(HKEYS key) Returns all the fields in a hash.`,
|
||||
Sync: false,
|
||||
Type: "BUILT_IN",
|
||||
KeyExtractionFunc: hkeysKeyFunc,
|
||||
HandlerFunc: handleHKEYS,
|
||||
},
|
||||
@@ -923,6 +932,7 @@ Return the string length of the values stored at the specified fields. 0 if the
|
||||
Categories: []string{constants.HashCategory, constants.WriteCategory, constants.FastCategory},
|
||||
Description: `(HINCRBYFLOAT key field increment) Increment the hash value by the float increment.`,
|
||||
Sync: true,
|
||||
Type: "BUILT_IN",
|
||||
KeyExtractionFunc: hincrbyKeyFunc,
|
||||
HandlerFunc: handleHINCRBY,
|
||||
},
|
||||
@@ -932,6 +942,7 @@ Return the string length of the values stored at the specified fields. 0 if the
|
||||
Categories: []string{constants.HashCategory, constants.WriteCategory, constants.FastCategory},
|
||||
Description: `(HINCRBY key field increment) Increment the hash value by the integer increment`,
|
||||
Sync: true,
|
||||
Type: "BUILT_IN",
|
||||
KeyExtractionFunc: hincrbyKeyFunc,
|
||||
HandlerFunc: handleHINCRBY,
|
||||
},
|
||||
@@ -941,6 +952,7 @@ Return the string length of the values stored at the specified fields. 0 if the
|
||||
Categories: []string{constants.HashCategory, constants.ReadCategory, constants.SlowCategory},
|
||||
Description: `(HGETALL key) Get all fields and values of a hash.`,
|
||||
Sync: false,
|
||||
Type: "BUILT_IN",
|
||||
KeyExtractionFunc: hgetallKeyFunc,
|
||||
HandlerFunc: handleHGETALL,
|
||||
},
|
||||
@@ -950,6 +962,7 @@ Return the string length of the values stored at the specified fields. 0 if the
|
||||
Categories: []string{constants.HashCategory, constants.ReadCategory, constants.FastCategory},
|
||||
Description: `(HEXISTS key field) Returns if field is an existing field in the hash.`,
|
||||
Sync: false,
|
||||
Type: "BUILT_IN",
|
||||
KeyExtractionFunc: hexistsKeyFunc,
|
||||
HandlerFunc: handleHEXISTS,
|
||||
},
|
||||
@@ -959,6 +972,7 @@ Return the string length of the values stored at the specified fields. 0 if the
|
||||
Categories: []string{constants.HashCategory, constants.WriteCategory, constants.FastCategory},
|
||||
Description: `(HDEL key field [field ...]) Deletes the specified fields from the hash.`,
|
||||
Sync: true,
|
||||
Type: "BUILT_IN",
|
||||
KeyExtractionFunc: hdelKeyFunc,
|
||||
HandlerFunc: handleHDEL,
|
||||
},
|
||||
|
Reference in New Issue
Block a user