neo4j / sdn-rx

Nextgen Spring Data module for Neo4j supporting (not only) reactive data access and immutable support
https://neo4j.github.io/sdn-rx
Apache License 2.0
65 stars 23 forks source link

Counting without duplicate #188

Closed romain-rossi closed 4 years ago

romain-rossi commented 4 years ago

Please, could you add the ability to count without duplicate (https://neo4j.com/docs/cypher-manual/current/functions/aggregating/#_counting_with_and_without_duplicates) to the org.neo4j.springframework.data.core.cypher.Functions?

Unit Test Proposal:

@Test
void gh188() {
    final Node r = node("Resume").named("r");
    final Node u = node("User").named("u");

    Statement s = match(r.relationshipFrom(u, "HAS"))
        .returning(Functions.countDistinct(r.getRequiredSymbolicName()).as("r"))
        .build();

    assertThat(cypherRenderer.render(s))
        .isEqualTo("MATCH (r:Resume)<-[:HAS]-(u:User) RETURN COUNT(DISTINCT r) as r");
}

Thanks!