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

How to aggregate on MaybeFields? #547

Open
stevemao opened this issue May 14, 2022 · 1 comment
Open

How to aggregate on MaybeFields? #547

stevemao opened this issue May 14, 2022 · 1 comment

Comments

@stevemao
Copy link
Contributor

stevemao commented May 14, 2022

After optionalRestrict, I get maybeFieldsR but then I need to aggregate on it. I cannot figure out how to do that other than converting it to nullable.

These work

aggregateMaybeFields = do
        aggregate (p1 groupBy) $ do
                return (toFields @Bool @(Field SqlBool) True)

aggregateMaybeFields2 = do
        aggregate (p1 groupBy) $ do
                return (toFields @(Maybe Bool) @(FieldNullable SqlBool) (Just True))

This doesn't

aggregateMaybeFields3 = do
        aggregate (p1 groupBy) $ do
                return (toFields @(Maybe Bool) @(MaybeFields SqlBool) (Just True))
@tomjaguarpaw
Copy link
Owner

Ah yes, I don't think there is any way of aggregating over MaybeFields. I should think about how to incorporate that. In the meantime I think it's best to use nullable, as you have discovered.

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

No branches or pull requests

2 participants