Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return list or nested object as mapped result #278

Open
bastiaan-dev opened this issue Jun 21, 2023 · 0 comments
Open

Return list or nested object as mapped result #278

bastiaan-dev opened this issue Jun 21, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@bastiaan-dev
Copy link

bastiaan-dev commented Jun 21, 2023

A bit related to #264 (@bsbodden thx for the fix, tested the changes and both #264 and #265 seem to work)

Not sure if this is a bug or feature request. But instead of returning/mapping every property within a list or nested property, I would like to return the complete list/nested object.

this would then correspond with calling Redis from cli by:

"FT.SEARCH" "nl.domain.myIndex" "LIMIT" "0" "10000" "RETURN" "1" "$.nestedObject" "DIALECT" "1"

instead of:

"FT.SEARCH" "nl.domain.myIndex" "LIMIT" "0" "10000" "RETURN" "2" "$.nestedObject.property1" "$.nestedObject.property2" "DIALECT" "1"

Some (not functioning tests to demonstrate the idea):

@Test
  void testMapEntityStreamsReturnCompleteNestedList() {
    var results = entityStream.of(DeepList.class)
            .filter(DeepList$.NEST_LEVELS.NAME.eq("nl-2-2"))
            .map(DeepList$.NEST_LEVELS) // would like to map complete list of objects instead of each property withing nested list object 
            .collect(Collectors.toList());

    // expecting results.get(0) being instance of List<NestLevel2>
  }

  @Test
  void testMapEntityStreamsReturnCompleteNestedObject() {
    var results = entityStream.of(DeepNest.class)
            .filter(DeepNest$.NEST_LEVEL1_NEST_LEVEL2_NAME.eq("nl-2-2"))
            .map(DeepNest$.NEST_LEVEL1) // would like to map complete object instead of each property seperately
            .collect(Collectors.toList());

    // expecting results.get(0) being instance of NestLevel1
  }
@bsbodden bsbodden self-assigned this Jun 22, 2023
@bsbodden bsbodden added the enhancement New feature or request label Jun 23, 2023
@bsbodden bsbodden assigned maorohana-redis and unassigned bsbodden May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants