How to use the comb.hitch function in comb

To help you get started, we’ve selected a few comb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github C2FO / patio / example / querying.example.js View on Github external
User.forUpdate().first({id: 1}).chain(function (user) {
            // SELECT * FROM user WHERE id = 1 FOR UPDATE
            user.password = null;
            user.save().chain(comb.hitch(ret, "callback"), comb.hitch(ret, "errback"));
        }, comb.hitch(ret, "errback"));
        return ret;
github C2FO / patio / example / associations / customDataset.example.js View on Github external
if (children.length) {
                    console.log("The children's names are " + children.map(function (child) {
                        return child.name;
                    }));
                }
            });
        });
    })
    .chain(function () {
        return Child.findById(1).chain(function (child) {
            return child.biologicalFather.chain(function (father) {
                console.log(child.name + " father is " + father.name);
            });
        });
    })
    .chain(comb.hitch(patio, "disconnect"), errorHandler);
github C2FO / patio / example / querying.example.js View on Github external
this.isVerified(Boolean, {"default": false});
                this.lastAccessed(Date);
                this.created(sql.TimeStamp);
                this.updated(sql.DateTime);
            });
        },
        function () {
            return DB.createTable("blog", function () {
                this.primaryKey("id");
                this.title(String);
                this.numPosts("integer");
                this.numFollowers("integer");
                this.foreignKey("userId", "user", {key: "id"});
            });
        },
        comb.hitch(patio, "syncModels")
    ]);
};
github C2FO / patio / example / associations / manyToMany.alternateJoinTable.example.js View on Github external
//GPA
                    this.gpa(sql.Decimal, {size: [1, 3], "default": 0.0});
                    //Honors Program?
                    this.isHonors(Boolean, {"default": false});
                    //freshman, sophmore, junior, or senior
                    this.classYear("char");
                })
            );
        },
        function () {
            return DB.createTable("students_classes", function () {
                this.foreignKey("studentId", "student", {key: "id"});
                this.foreignKey("classId", "class", {key: "id"});
            });
        },
        comb.hitch(patio, "syncModels")
    ]);
};
github C2FO / patio / example / associations / manyToMany.example.js View on Github external
//GPA
                    this.gpa(sql.Decimal, {size: [1, 3], "default": 0.0});
                    //Honors Program?
                    this.isHonors(Boolean, {"default": false});
                    //freshman, sophmore, junior, or senior
                    this.classYear("char");
                })
            );
        },
        function () {
            return DB.createTable("classes_students", function () {
                this.foreignKey("studentId", "student", {key: "id"});
                this.foreignKey("classId", "class", {key: "id"});
            });
        },
        comb.hitch(patio, "syncModels")
    ]);
};
github C2FO / patio / example / application / plugins / ExpressPlugin.js View on Github external
routes: function () {
                if (comb.isUndefined(this.__routes)) {
                    var routes = this.__routes = [
                        ["get", "/" + this.tableName + "/:id", comb.hitch(this, "findByIdRoute")],
                        ["delete", "/" + this.tableName + "/:id", comb.hitch(this, "removeByIdRoute")]
                    ];
                }
                return this.__routes;
            }
github C2FO / patio / example / associations / manyToMany.alternateKeys.example.js View on Github external
//GPA
                    this.gpa(sql.Decimal, {size: [1, 3], "default": 0.0});
                    //Honors Program?
                    this.isHonors(Boolean, {"default": false});
                    //freshman, sophmore, junior, or senior
                    this.classYear("char");
                })
            );
        },
        function () {
            return DB.createTable("classes_students", function () {
                this.foreignKey("studentKey", "student", {key: "id"});
                this.foreignKey("classKey", "class", {key: "id"});
            });
        },
        comb.hitch(patio, "syncModels")
    ]);
};
github C2FO / patio / example / associations / oneToMany.example.js View on Github external
DB.createTable("stepFather", function () {
                    this.primaryKey("id");
                    this.name(String, {unique: true});
                })
            );
        },
        function () {
            return DB.createTable("child", function () {
                this.primaryKey("id");
                this.name(String);
                this.foreignKey("biologicalFatherId", "biologicalFather", {key: "id"});
                this.foreignKey("stepFatherId", "stepFather", {key: "name", type: String});
            });
        },
        comb.hitch(patio, "syncModels")
    ]);

};
github C2FO / patio / example / associations / manyToMany.alternatePrimaryKeys.example.js View on Github external
this.classYear("char");
                })
            );
        },
        function () {
            //this isnt very practical but it gets the point across
            return DB.createTable("classes_students", function () {
                this.firstNameKey(String);
                this.lastNameKey(String);
                this.nameKey(String);
                this.subjectKey(String);
                this.foreignKey(["firstNameKey", "lastNameKey"], "student", {key: ["firstName", "lastName"]});
                this.foreignKey(["nameKey", "subjectKey"], "class", {key: ["name", "subject"]});
            });
        },
        comb.hitch(patio, "syncModels")
    ]);
};