Skip to content
This repository was archived by the owner on Jul 7, 2022. It is now read-only.
This repository was archived by the owner on Jul 7, 2022. It is now read-only.

New Feature: Include() #69

@LorenDorez

Description

@LorenDorez

I come from a web background where i have bee using EntityFramework alot. I think a nice feature would be to have an .include() function.

Essentially. what it would do it load another Query/Table into a variable into the first query. This helps to create Nested objects where a table join just doesnt do the same things.

Example of what im using right now:

read: function () {
                if (global.isOnline()) {
                    return global.oversii.api.fetch.post("property")
                        .then((jsonData) => jsonData);
                }
                else {
                    return new Promise((resolve, reject) => {
                        db.context.all("SELECT * FROM Property")
                            .then((properties) => {
                                for (let i = 0; i <= properties.length - 1; i++) {
                                    const property = properties[i];
                                    db.tables.violationWorkflowPeriod.getById(property.ViolationWorkflowPeriodId)
                                        .then((vwp) => {
                                            property.ViolationWorkflowPeriod = vwp;
                                            if (i === properties.length - 1) {
                                                resolve(properties);
                                            }
                                        })
                                        .catch((error) => db.error(error));
                                }
                            })
                            .catch((error) => db.error(error));
                    });
                }
            },

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions