How to use the comb.serial 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
var connectAndCreateSchema = function () {
    //This assumes new tables each time you could just connect to the database
    return comb.serial([
        function () {
            return DB.forceDropTable("blog", "user");
        },
        function () {
            //drop and recreate the user
            return DB.createTable("user", function () {
                this.primaryKey("id");
                this.name(String);
                this.password(String);
                this.dateOfBirth(Date);
                this.isVerified(Boolean, {"default": false});
                this.lastAccessed(Date);
                this.created(sql.TimeStamp);
                this.updated(sql.DateTime);
            });
        },
github C2FO / patio / example / associations / oneToMany.example.js View on Github external
var createTables = function () {
    return comb.serial([
        function () {
            return DB.forceDropTable("child", "stepFather", "biologicalFather");
        },
        function () {
            return comb.when(
                DB.createTable("biologicalFather", function () {
                    this.primaryKey("id");
                    this.name(String);
                }),

                DB.createTable("stepFather", function () {
                    this.primaryKey("id");
                    this.name(String, {unique: true});
                })
            );
        },
github C2FO / patio / example / associations / oneToOne.example.js View on Github external
var createTables = function () {
    return comb.serial([
        function () {
            return DB.forceDropTable(["capital", "state"]);
        },
        function () {
            return DB.createTable("state", function () {
                this.primaryKey("id");
                this.name(String)
                this.population("integer");
                this.founded(Date);
                this.climate(String);
                this.description("text");
            });
        },
        function () {
            return DB.createTable("capital", function () {
                this.primaryKey("id");
github C2FO / patio / example / associations / customDataset.example.js View on Github external
var createTables = function () {
    return comb.serial([
        function () {
            return DB.forceDropTable("child", "biologicalFather");
        },
        function () {
            return DB.createTable("biologicalFather", function () {
                this.primaryKey("id");
                this.name(String);
            });
        },
        function () {
            return DB.createTable("child", function () {
                this.primaryKey("id");
                this.name(String);
                this.foreignKey("biologicalFatherId", "biologicalFather", {key: "id"});
            });
        },
github C2FO / patio / example / inheritance.example.js View on Github external
var createTables = function () {
    return comb.serial([
        function () {
            return DB.forceDropTable(["staff", "executive", "manager", "employee"]);
        },
        function () {
            return DB.createTable("employee", function () {
                this.primaryKey("id");
                this.name(String);
                this.kind(String);
            });
        },
        function () {
            return DB.createTable("manager", function () {
                this.foreignKey("id", "employee", {key: "id"});
                this.numStaff("integer");
            });
        },
github C2FO / patio / example / associations / oneToMany.alternateKeys.example.js View on Github external
var createTables = function () {
    return comb.serial([
        function () {
            return DB.forceDropTable("child", "stepFather", "biologicalFather");
        },
        function () {
            return comb.when(
                DB.createTable("biologicalFather", function () {
                    this.primaryKey("id");
                    this.name(String);
                }),

                DB.createTable("stepFather", function () {
                    this.primaryKey("id");
                    this.name(String, {unique: true});
                })
            );
        },
github C2FO / patio / example / associations / manyToMany.example.js View on Github external
var createTables = function () {
    return comb.serial([
        function () {
            return DB.forceDropTable("classesStudents", "studentsClasses", "class", "student");
        },
        function () {
            return comb.when(
                DB.createTable("class", function () {
                    this.primaryKey("id");
                    this.semester("char", {size: 10});
                    this.name(String);
                    this.subject(String);
                    this.description("text");
                    this.graded(Boolean, {"default": true});
                }),
                DB.createTable("student", function () {
                    this.primaryKey("id");
                    this.firstName(String);
github C2FO / patio / example / model.multiDB.example.js View on Github external
var connectAndCreateSchema = function () {
    //This assumes new tables each time you could just connect to the database
    return comb.serial([
        function () {
            return comb.when(
                DB1.forceCreateTable("user", function () {
                    this.primaryKey("id");
                    this.firstName(String);
                    this.lastName(String);
                    this.password(String);
                    this.dateOfBirth(Date);
                    this.isVerified(Boolean, {"default": false})
                    this.created(sql.TimeStamp);
                    this.updated(sql.DateTime);
                }),
                //drop and recreate the user
                DB2.forceCreateTable("user", function () {
                    this.primaryKey("id");
                    this.firstName(String);
github C2FO / patio / example / associations / manyToMany.alternateKeys.example.js View on Github external
var createTables = function () {
    return comb.serial([
        function () {
            return DB.forceDropTable("classesStudents", "studentsClasses", "class", "student");
        },
        function () {
            return comb.when(
                DB.createTable("class", function () {
                    this.primaryKey("id");
                    this.semester("char", {size: 10});
                    this.name(String);
                    this.subject(String);
                    this.description("text");
                    this.graded(Boolean, {"default": true});
                }),
                DB.createTable("student", function () {
                    this.primaryKey("id");
                    this.firstName(String);
github C2FO / patio / benchmark / benchmark.js View on Github external
var loop = function (async, cb, limit) {
    var saves = [];
    limit = limit || LIMIT;
    for (var i = 0; i < limit; i++) {
        saves.push(async ? cb(i) : comb.partial(cb, i));
    }
    if (async) {
        saves = new comb.PromiseList(saves, true);
    }
    return async ? saves : comb.serial(saves);
};