tmp commit

This commit is contained in:
Kruno Tomola Fabro 2016-08-30 02:32:53 +01:00
parent 4542b56c18
commit 57a3c053e8
2 changed files with 22 additions and 14 deletions

View File

@ -221,7 +221,7 @@ auto load_queries(Db &db)
return t.commit();
};
// MATCH ()-[r]-() WHERE ID(r) = 0 DELETE r
// MATCH ()-[r]-() WHERE ID(r) = id DELETE r
auto match_edge_id_delete = [&db](const properties_t &args) {
DbAccessor t(db);
@ -262,11 +262,17 @@ auto load_queries(Db &db)
return t.commit();
};
// MATCH ()-[r]-() WHERE ID(r) = 0 DELETE r
auto = [&db](const properties_t &args) {
// MATCH (n)-[:TYPE]->(m) WHERE ID(n) = id RETURN m
auto match_type_id_return = [&db](const properties_t &args) {
DbAccessor t(db);
return t.commit();
auto ov = t.vertex_find(args[0]->as<Int64>().value);
if (!option_fill(ov)) return t.commit(), false;
auto v = ov.take();
auto resoults = iter::make_f`
return t.commit();
};
// Blueprint:

View File

@ -6,26 +6,28 @@
namespace iter
{
// Class which maps values returned by I iterator into value of type T with OP
// Class which filters values returned by I iterator into value of type T with
// OP
// function.
// T - type of return value
// I - iterator type
// OP - type of mapper function
template <class T, class I, class OP>
class Map : public IteratorBase<T>
class Filter : public IteratorBase<T>
{
public:
Map() = delete;
Filter() = delete;
// Map operation is designed to be used in chained calls which operate on a
// iterator. Map will in that usecase receive other iterator by value and
// Filter operation is designed to be used in chained calls which operate on
// a
// iterator. Filter will in that usecase receive other iterator by value and
// std::move is a optimization for it.
Map(I &&iter, OP &&op) : iter(std::move(iter)), op(std::move(op)) {}
Filter(I &&iter, OP &&op) : iter(std::move(iter)), op(std::move(op)) {}
Map(Map &&m) : iter(std::move(m.iter)), op(std::move(m.op)) {}
Filter(Filter &&m) : iter(std::move(m.iter)), op(std::move(m.op)) {}
~Map() final {}
~Filter() final {}
Option<T> next() final
{
@ -46,7 +48,7 @@ template <class I, class OP>
auto make_map(I &&iter, OP &&op)
{
// Compiler cant deduce type T. decltype is here to help with it.
return Map<decltype(op(iter.next().take())), I, OP>(std::move(iter),
std::move(op));
return Filter<decltype(op(iter.next().take())), I, OP>(std::move(iter),
std::move(op));
}
}