Skip to content

Commit

Permalink
add: initial code for geosearch command
Browse files Browse the repository at this point in the history
  • Loading branch information
Dev79844 committed Nov 21, 2024
1 parent 2830518 commit 3d188c9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/eval/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -1321,6 +1321,14 @@ var (
NewEval: evalGEODIST,
KeySpecs: KeySpecs{BeginIndex: 1},
}
geoSearchCmdMeta = DiceCmdMeta{
Name: "GEOSEARCH",
Info: `Return the members of a sorted set populated with geospatial information using GEOADD, which are within the borders of the area specified by a given shape.`,
Arity: -6,
IsMigrated: true,
NewEval: evalGEOSEARCH,
KeySpecs: KeySpecs{BeginIndex: 1},
}
jsonstrappendCmdMeta = DiceCmdMeta{
Name: "JSON.STRAPPEND",
Info: `JSON.STRAPPEND key [path] value
Expand Down Expand Up @@ -1466,6 +1474,7 @@ func init() {
DiceCmds["FLUSHDB"] = flushdbCmdMeta
DiceCmds["GEOADD"] = geoAddCmdMeta
DiceCmds["GEODIST"] = geoDistCmdMeta
DiceCmds["GEOSEARCH"] = geoSearchCmdMeta
DiceCmds["GET"] = getCmdMeta
DiceCmds["GETBIT"] = getBitCmdMeta
DiceCmds["GETDEL"] = getDelCmdMeta
Expand Down
16 changes: 16 additions & 0 deletions internal/eval/store_eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -6505,3 +6505,19 @@ func evalTYPE(args []string, store *dstore.Store) *EvalResponse {
Error: nil,
}
}

func evalGEOSEARCH(args []string, store *dstore.Store) *EvalResponse {
if (len(args) < 6 || len(args) > 15){
return &EvalResponse{
Result: nil,
Error: diceerrors.ErrWrongArgumentCount("GEOSEARCH"),
}
}

//TODO: add implementation for GEOSEARCH

return &EvalResponse{
Result: "geosearch implementation",
Error: nil,
}
}

0 comments on commit 3d188c9

Please sign in to comment.