2021-11-28 15:29:26 +08:00
|
|
|
// Copyright 2021, Roman Gershman. All rights reserved.
|
|
|
|
// See LICENSE for licensing terms.
|
2021-11-24 20:09:53 +08:00
|
|
|
//
|
|
|
|
|
|
|
|
#include "server/common_types.h"
|
|
|
|
|
|
|
|
#include <absl/strings/str_cat.h>
|
|
|
|
|
|
|
|
#include "base/logging.h"
|
2021-12-20 17:42:55 +08:00
|
|
|
#include "server/error.h"
|
2021-11-24 20:09:53 +08:00
|
|
|
|
|
|
|
namespace dfly {
|
|
|
|
|
|
|
|
using std::string;
|
|
|
|
|
|
|
|
|
|
|
|
string WrongNumArgsError(std::string_view cmd) {
|
|
|
|
return absl::StrCat("wrong number of arguments for '", cmd, "' command");
|
|
|
|
}
|
|
|
|
|
|
|
|
const char kSyntaxErr[] = "syntax error";
|
2022-01-02 16:40:16 +08:00
|
|
|
const char kWrongTypeErr[] = "-WRONGTYPE Operation against a key holding the wrong kind of value";
|
2021-11-24 20:09:53 +08:00
|
|
|
const char kInvalidIntErr[] = "value is not an integer or out of range";
|
|
|
|
const char kUintErr[] = "value is out of range, must be positive";
|
2021-12-26 23:25:49 +08:00
|
|
|
const char kDbIndOutOfRangeErr[] = "DB index is out of range";
|
|
|
|
const char kInvalidDbIndErr[] = "invalid DB index";
|
2021-11-24 20:09:53 +08:00
|
|
|
|
|
|
|
} // namespace dfly
|
|
|
|
|
|
|
|
namespace std {
|
|
|
|
|
|
|
|
ostream& operator<<(ostream& os, dfly::CmdArgList ras) {
|
|
|
|
os << "[";
|
|
|
|
if (!ras.empty()) {
|
|
|
|
for (size_t i = 0; i < ras.size() - 1; ++i) {
|
|
|
|
os << dfly::ArgS(ras, i) << ",";
|
|
|
|
}
|
|
|
|
os << dfly::ArgS(ras, ras.size() - 1);
|
|
|
|
}
|
|
|
|
os << "]";
|
|
|
|
|
|
|
|
return os;
|
|
|
|
}
|
|
|
|
|
2021-12-26 23:25:49 +08:00
|
|
|
} // namespace std
|