21 typedef std::function<void(Response, QString)> Callback;
34 Command(
const QList<QByteArray>& cmd,
int db = -1);
43 Command(
const QList<QByteArray>& cmd, QObject * context, Callback callback,
int db = -1);
105 void setCallBack(QObject* context, Callback callback);
136 bool isEmpty()
const;
141 bool isScanCommand()
const;
142 bool isSelectCommand()
const;
143 bool isSubscriptionCommand()
const;
144 bool isUnSubscriptionCommand()
const;
156 QList<QByteArray> m_commandWithArguments;
158 bool m_hiPriorityCommand;
The Command class.
Definition: command.h:18
QList< QByteArray > getSplitedRepresentattion() const
Get source command as list of args.
Definition: command.cpp:155
bool isHiPriorityCommand() const
isHiPriorityCommand
Definition: command.cpp:133
QByteArray getRawString(int limit=200) const
Get source command as single string.
Definition: command.cpp:148
Command & append(const QByteArray &part)
Append additional arg/part to command ("SET 1" + "2")
Definition: command.cpp:30
QString getPartAsString(int i)
Get specific argument/part of the command.
Definition: command.cpp:160
QByteArray getByteRepresentation() const
Get command in RESP format.
Definition: command.cpp:173
void markAsHiPriorityCommand()
Mark this command as High Priority command. Command will be added to the begining of the Connection q...
Definition: command.cpp:189
virtual ~Command()
~Command
Definition: command.cpp:26
int getDbIndex() const
Get database index where this command should be executed.
Definition: command.cpp:138
Callback getCallBack() const
getCallBack
Definition: command.cpp:97
bool hasDbIndex() const
hasDbIndex
Definition: command.cpp:102
bool hasCallback() const
hasCallback
Definition: command.cpp:86
static QList< QByteArray > splitCommandString(const QString &)
Parse command from raw string. Useful for CLI clients.
Definition: command.cpp:36
Command()
Constructs empty command.
Definition: command.cpp:7
QObject * getOwner() const
Get callback context.
Definition: command.cpp:143
bool isValid() const
isValid
Definition: command.cpp:194
void setCallBack(QObject *context, Callback callback)
Set context and callback.
Definition: command.cpp:91