update naming

This commit is contained in:
antoniofilipovic
2023-09-07 18:07:49 +02:00
parent 72740d4278
commit b4715a5e50
4 changed files with 37 additions and 25 deletions

View File

@@ -94,9 +94,13 @@ class EdgeAccessor final {
VertexAccessor From() const;
VertexAccessor ToWithDeleted() const;
/// When edge is deleted and you are accessing To vertex
/// for_deleted_ flag will in this case be updated properly
VertexAccessor DeletedEdgeToVertex() const;
VertexAccessor FromWithDeleted() const;
/// When edge is deleted and you are accessing From vertex
/// for_deleted_ flag will in this case be updated properly
VertexAccessor DeletedEdgeFromVertex() const;
bool IsCycle() const;
@@ -210,9 +214,11 @@ inline VertexAccessor EdgeAccessor::To() const { return VertexAccessor(impl_.ToV
inline VertexAccessor EdgeAccessor::From() const { return VertexAccessor(impl_.FromVertex()); }
inline VertexAccessor EdgeAccessor::ToWithDeleted() const { return VertexAccessor(impl_.ToVertexWithDeleted()); }
inline VertexAccessor EdgeAccessor::DeletedEdgeToVertex() const { return VertexAccessor(impl_.DeletedEdgeToVertex()); }
inline VertexAccessor EdgeAccessor::FromWithDeleted() const { return VertexAccessor(impl_.FromVertexWithDeleted()); }
inline VertexAccessor EdgeAccessor::DeletedEdgeFromVertex() const {
return VertexAccessor(impl_.DeletedEdgeFromVertex());
}
inline bool EdgeAccessor::IsCycle() const { return To() == From(); }

View File

@@ -487,14 +487,15 @@ mgp_value::mgp_value(const memgraph::query::TypedValue &tv, mgp_graph *graph, me
edge_v = std::visit(
memgraph::utils::Overloaded{
[&tv, graph, &allocator](memgraph::query::DbAccessor *) {
return allocator.new_object<mgp_edge>(tv.ValueEdge(), tv.ValueEdge().FromWithDeleted(),
tv.ValueEdge().ToWithDeleted(), graph);
return allocator.new_object<mgp_edge>(tv.ValueEdge(), tv.ValueEdge().DeletedEdgeFromVertex(),
tv.ValueEdge().DeletedEdgeToVertex(), graph);
},
[&tv, graph, &allocator](memgraph::query::SubgraphDbAccessor *db_impl) {
return allocator.new_object<mgp_edge>(
tv.ValueEdge(),
memgraph::query::SubgraphVertexAccessor(tv.ValueEdge().FromWithDeleted(), db_impl->getGraph()),
memgraph::query::SubgraphVertexAccessor(tv.ValueEdge().ToWithDeleted(), db_impl->getGraph()),
memgraph::query::SubgraphVertexAccessor(tv.ValueEdge().DeletedEdgeFromVertex(),
db_impl->getGraph()),
memgraph::query::SubgraphVertexAccessor(tv.ValueEdge().DeletedEdgeToVertex(), db_impl->getGraph()),
graph);
}},
graph->impl);
@@ -850,19 +851,20 @@ mgp_value::mgp_value(mgp_value &&other, memgraph::utils::MemoryResource *m) : ty
mgp_value::~mgp_value() noexcept { DeleteValueMember(this); }
mgp_edge *mgp_edge::Copy(const mgp_edge &edge, mgp_memory &memory) {
return std::visit(memgraph::utils::Overloaded{
[&](memgraph::query::DbAccessor *) {
return NewRawMgpObject<mgp_edge>(&memory, edge.impl, edge.impl.FromWithDeleted(),
edge.impl.ToWithDeleted(), edge.from.graph);
},
[&](memgraph::query::SubgraphDbAccessor *db_impl) {
return NewRawMgpObject<mgp_edge>(
&memory, edge.impl,
memgraph::query::SubgraphVertexAccessor(edge.impl.FromWithDeleted(), db_impl->getGraph()),
memgraph::query::SubgraphVertexAccessor(edge.impl.ToWithDeleted(), db_impl->getGraph()),
edge.to.graph);
}},
edge.to.graph->impl);
return std::visit(
memgraph::utils::Overloaded{
[&](memgraph::query::DbAccessor *) {
return NewRawMgpObject<mgp_edge>(&memory, edge.impl, edge.impl.DeletedEdgeFromVertex(),
edge.impl.DeletedEdgeToVertex(), edge.from.graph);
},
[&](memgraph::query::SubgraphDbAccessor *db_impl) {
return NewRawMgpObject<mgp_edge>(
&memory, edge.impl,
memgraph::query::SubgraphVertexAccessor(edge.impl.DeletedEdgeFromVertex(), db_impl->getGraph()),
memgraph::query::SubgraphVertexAccessor(edge.impl.DeletedEdgeToVertex(), db_impl->getGraph()),
edge.to.graph);
}},
edge.to.graph->impl);
}
mgp_error mgp_value_copy(mgp_value *val, mgp_memory *memory, mgp_value **result) {

View File

@@ -105,12 +105,12 @@ VertexAccessor EdgeAccessor::ToVertex() const {
return VertexAccessor{to_vertex_, transaction_, indices_, constraints_, config_};
}
VertexAccessor EdgeAccessor::FromVertexWithDeleted() const {
VertexAccessor EdgeAccessor::DeletedEdgeFromVertex() const {
return VertexAccessor{from_vertex_, transaction_, indices_,
constraints_, config_, for_deleted_ && from_vertex_->deleted};
}
VertexAccessor EdgeAccessor::ToVertexWithDeleted() const {
VertexAccessor EdgeAccessor::DeletedEdgeToVertex() const {
return VertexAccessor{to_vertex_, transaction_, indices_, constraints_, config_, for_deleted_ && to_vertex_->deleted};
}

View File

@@ -52,9 +52,13 @@ class EdgeAccessor final {
VertexAccessor ToVertex() const;
VertexAccessor FromVertexWithDeleted() const;
/// When edge is deleted and you are accessing To vertex
/// for_deleted_ flag will in this case be updated properly
VertexAccessor DeletedEdgeFromVertex() const;
VertexAccessor ToVertexWithDeleted() const;
/// When edge is deleted and you are accessing To vertex
/// for_deleted_ flag will in this case be updated properly
VertexAccessor DeletedEdgeToVertex() const;
EdgeTypeId EdgeType() const { return edge_type_; }