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

feat: Move to class based projections #33227

Merged
merged 9 commits into from May 15, 2024
Merged

feat: Move to class based projections #33227

merged 9 commits into from May 15, 2024

Conversation

abhvsn
Copy link
Contributor

@abhvsn abhvsn commented May 7, 2024

Description

PR to add support for class-based projection.
Method signature:

public <P> List<P> all(Class<P> projectionClass) {
        return repo.queryAllExecute(this, projectionClass);
    }

public <P> Optional<P> one(Class<P> projectionClass) {
        return repo.queryOneExecute(this, projectionClass);
    }

Todos:

  1. This change can work with top-level fields only
e.g. class EntityClass {
	String id;
	String topLevelField;
	NestedObject nestedObject;
}

class NestedObject {
	String field1;
}

With this setup we can project `nestedObject` but not `nestedobject.field1`

We expect to move to separate tables for the JSONB columns going forward hence not putting efforts here.

@abhvsn abhvsn marked this pull request as ready for review May 13, 2024 10:58
@abhvsn abhvsn requested a review from sharat87 as a code owner May 13, 2024 10:58
@abhvsn abhvsn merged commit 4ce1446 into pg May 15, 2024
4 checks passed
@abhvsn abhvsn deleted the pg-generic-projections branch May 15, 2024 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants