jetstreamapp / soql-parser-js

Javascript SOQL parser
https://jetstreamapp.github.io/soql-parser-js/
MIT License
77 stars 20 forks source link

Formatting: TYPEOF query should provide better formatting #135

Closed paustint closed 3 years ago

paustint commented 3 years ago

Description

SELECT Id, Name, Address, AnnualRevenue, ConvertedAccount.Id, ConvertedAccount.Name,
    ConvertedContact.Id, ConvertedContact.Name, ConvertedOpportunity.Id, ConvertedOpportunity.Name,
    TYPEOF Owner WHEN User THEN Id, Name, Account.Id, Account.Name, Account.GL_Treatment__c, Account.GL_Treatment__r.Id, Account.GL_Treatment__r.Name, Account.auto_number_test_1__c ELSE Id END
FROM Lead

Not sure the best structure, but something like this might be nice

SELECT Id, Name, Address, AnnualRevenue, ConvertedAccount.Id, ConvertedAccount.Name,
    ConvertedContact.Id, ConvertedContact.Name, ConvertedOpportunity.Id, ConvertedOpportunity.Name,
        TYPEOF Owner
            WHEN User
                THEN Id, Name, Account.Id, Account.Name, Account.GL_Treatment__c, Account.GL_Treatment__r.Id,
                    Account.GL_Treatment__r.Name, Account.auto_number_test_1__c
            ELSE Id
        END
FROM Lead