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

[Feature]: Add builder pattern on top of existing SDK query patterns #296

Closed
ponderingdemocritus opened this issue Oct 6, 2024 · 0 comments · Fixed by #320
Closed

[Feature]: Add builder pattern on top of existing SDK query patterns #296

ponderingdemocritus opened this issue Oct 6, 2024 · 0 comments · Fixed by #320
Labels
enhancement New feature or request

Comments

@ponderingdemocritus
Copy link
Contributor

ponderingdemocritus commented Oct 6, 2024

Feature Request

Currently the SDK supports regular query patterns. This is nice to fully understand the queries, however it is possible to build a greater abstraction over this.

Instead of

            world: {
                player: {
                    $: { where: { id: { $eq: "1" }, name: { $eq: "Alice" } } },
                },
            },
            universe: {
                galaxy: {
                    $: {
                        where: { name: { $is: "Milky Way" } },
                    },
                },
            },

be something like

        const query: QueryType<MockSchemaType> = new QueryBuilder()
            .namespace("world", world => world
                .model("player", player => player
                    .eq("id", "1")
                    .eq("name", "Alice")
                )
            )
            .namespace("universe", universe => universe
                .model("galaxy", galaxy => galaxy
                    .is("name", "Milky Way")
                )
            )
            .build();
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
No open projects
Status: No status
Development

Successfully merging a pull request may close this issue.

1 participant