salesforce-query-builder
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

SalesForce Query Builder

Installation

    npm i salesforce-query-builder

Lib

Simple example of QueryBuilder:

    new SFQuery('Contact')
        .select(['Id', 'Name'])
        .where("Name != null")
        .whereIn('Name', ['Maria', 'Ana'])
        .limit(3)
        .build()

    SELECT
        Id,
        Name
    FROM Contact
        WHERE Name != null AND Name IN ('Maria','Ana')
    LIMIT 3


    new SFQuery('Contact')
        .select([ 'Name'])
        .groupBy("Name")
        .build()

    SELECT
        Name
    FROM Contact
    GROUP BY Name


    new SFQuery('Contact')
        .select([ 'Name'])
        .offset(10)
        .limit(20)
        .build()

    SELECT
        Name
    FROM Contact
    OFFSET 10 LIMIT 20

Relationship example of QueryBuilder:

    new SFQuery('Contact')
        .select(['Id', 'Name','Account__r.Name'])
        .where("Name != null")
        .whereIn('Name', ['Maria', 'Ana'])
        .orderBy('Name', 'DESC')
        .limit(3)
        .build()

    SELECT
        Id,
        Name,
        Account__r.Name
    FROM Contact
        WHERE Name != null AND Name IN ('Maria','Ana')
    ORDER BY Name DESC
    LIMIT 3

EncodeQueryUrl example of QueryBuilder:

encodeQueryUrl(
  new SFQuery("Contact")
    .select(["Id", "Name"])
    .where("Name != null")
    .limit(3)
    .build()
);

("query/?q=SELECT+Id,Name+FROM+Contact+WHERE+Name+!=+null+LIMIT+3");

References

Package Sidebar

Install

npm i salesforce-query-builder

Weekly Downloads

7

Version

1.0.1

License

MIT

Unpacked Size

9.09 kB

Total Files

11

Last publish

Collaborators

  • lucasmaciel1996