Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support GEO #59

Merged
merged 8 commits into from
Feb 21, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
redis protocol compatible
  • Loading branch information
leviathan authored and leviathan committed Feb 15, 2017
commit 408e9cdc78c02a9d316450604409fecd5f25ff7e
8 changes: 4 additions & 4 deletions src/pika_geo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void GeoAddCmd::DoInitial(PikaCmdArgsType &argv, const CmdInfo* const ptr_info)

void GeoAddCmd::Do() {
nemo::Status s;
int64_t response = 0, ret;
int64_t count = 0, ret;
bool exist = false;
const std::shared_ptr<nemo::Nemo> db = g_pika_server->db();
std::vector<GeoPoint>::const_iterator iter = pos_.begin();
Expand All @@ -68,16 +68,16 @@ void GeoAddCmd::Do() {
}
s = db->ZAdd(key_, score, iter->name, &ret);
if (s.ok() && !exist) {
response = 1;
count += 1;
} else if (s.ok() && exist) {
response = 0;

} else {
res_.SetRes(CmdRes::kErrOther, s.ToString());
return;
}
}
SlotKeyAdd("z", key_);
res_.AppendInteger(response);
res_.AppendInteger(count);
return;
}

Expand Down