Polishing and fixes (#196)

* Remove SHOW from Memgraph lexer

* Change get_payload to payload
This commit is contained in:
antonio2368 2021-07-07 18:04:17 +02:00 committed by GitHub
parent fb5a2ed4b6
commit ae280fd8db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 4 additions and 6 deletions

View File

@ -817,7 +817,7 @@ struct mgp_messages;
/// Payload is not null terminated and not a string but rather a byte array.
/// You need to call mgp_message_payload_size() first, to read the size of
/// the payload.
const char *mgp_message_get_payload(const struct mgp_message *);
const char *mgp_message_payload(const struct mgp_message *);
/// Return the payload size
size_t mgp_message_payload_size(const struct mgp_message *);

View File

@ -69,7 +69,6 @@ ROLE : R O L E ;
ROLES : R O L E S ;
QUOTE : Q U O T E ;
SESSION : S E S S I O N ;
SHOW : S H O W ;
SNAPSHOT : S N A P S H O T ;
START : S T A R T ;
STATS : S T A T S ;

View File

@ -1453,7 +1453,7 @@ bool IsValidIdentifierName(const char *name) {
} // namespace query::procedure
const char *mgp_message_get_payload(const mgp_message *message) { return message->msg->Payload().data(); }
const char *mgp_message_payload(const mgp_message *message) { return message->msg->Payload().data(); }
size_t mgp_message_payload_size(const mgp_message *message) { return message->msg->Payload().size(); }

View File

@ -425,7 +425,7 @@ PyObject *PyMessageIsValid(PyMessage *self, PyObject *Py_UNUSED(ignored)) {
PyObject *PyMessageGetPayload(PyMessage *self, PyObject *Py_UNUSED(ignored)) {
MG_ASSERT(self->message);
auto payload_size = mgp_message_payload_size(self->message);
const auto *payload = mgp_message_get_payload(self->message);
const auto *payload = mgp_message_payload(self->message);
auto *raw_bytes = PyByteArray_FromStringAndSize(payload, payload_size);
if (!raw_bytes) {
PyErr_SetString(PyExc_RuntimeError, "Unable to get raw bytes from payload");

View File

@ -1,4 +1,3 @@
/// @file
#pragma once
#include <functional>

View File

@ -144,7 +144,7 @@ TEST_F(MgpApiTest, TestAllMgpKafkaCApi) {
// Test for payload size
EXPECT_EQ(mgp_message_payload_size(message), expected[i].payload_size);
// Test for payload
EXPECT_FALSE(std::strcmp(mgp_message_get_payload(message), expected[i].payload));
EXPECT_FALSE(std::strcmp(mgp_message_payload(message), expected[i].payload));
// Test for topic name
EXPECT_FALSE(std::strcmp(mgp_message_topic_name(message), expected[i].topic_name));
}