libs/apollo.js
function(model_name, model_schema, options) {
        if(!model_name || typeof(model_name) != "string")
            throw("Si deve specificare un nome per il modello");

        options = options || {};
        options.mismatch_behaviour = options.mismatch_behaviour || 'fail';
        if(options.mismatch_behaviour !== 'fail' && options.mismatch_behaviour !== 'drop')
            throw 'Valid option values for "mismatch_behaviour": "fail" , "drop". Got: "'+options.mismatch_behaviour+'"';

        //model_schema = schemer.normalize_model_schema(model_schema);
        schemer.validate_model_schema(model_schema);

        var base_properties = {
            name : model_name,
            schema : model_schema,
            keyspace : this._keyspace,
            mismatch_behaviour : options.mismatch_behaviour,
            define_connection : this._define_connection,
            cql : this._client,
            get_constructor : this.get_model.bind(this,model_name),
            connect: this.connect.bind(this)
        };

        return (this._models[model_name] = this._generate_model(base_properties));
    }
function(model_name, model_schema, options) {
        if(!model_name || typeof(model_name) != "string")
            throw("Si deve specificare un nome per il modello");

        options = options || {};
        options.mismatch_behaviour = options.mismatch_behaviour || 'fail';
        if(options.mismatch_behaviour !== 'fail' && options.mismatch_behaviour !== 'drop')
            throw 'Valid option values for "mismatch_behaviour": "fail" , "drop". Got: "'+options.mismatch_behaviour+'"';

        //model_schema = schemer.normalize_model_schema(model_schema);
        schemer.validate_model_schema(model_schema);

        var base_properties = {
            name : model_name,
            schema : model_schema,
            keyspace : this._keyspace,
            mismatch_behaviour : options.mismatch_behaviour,
            define_connection : this._define_connection,
            cql : this._client,
            get_constructor : this.get_model.bind(this,model_name),
            connect: this.connect.bind(this)
        };

        return (this._models[model_name] = this._generate_model(base_properties));
    }
function ( model_name , model_schema , options ) { if ( ! model_name || typeof ( model_name ) != "string" ) throw ( "Si deve specificare un nome per il modello" ) ; options = options || { } ; options . mismatch_behaviour = options . mismatch_behaviour || 'fail' ; if ( options . mismatch_behaviour !== 'fail' && options . mismatch_behaviour !== 'drop' ) throw 'Valid option values for "mismatch_behaviour": "fail" , "drop". Got: "' + options . mismatch_behaviour + '"' ; //model_schema = schemer.normalize_model_schema(model_schema); schemer . validate_model_schema ( model_schema ) ; var base_properties = { name : model_name , schema : model_schema , keyspace : this . _keyspace , mismatch_behaviour : options . mismatch_behaviour , define_connection : this . _define_connection , cql : this . _client , get_constructor : this . get_model . bind ( this , model_name ) , connect : this . connect . bind ( this ) } ; return ( this . _models [ model_name ] = this . _generate_model ( base_properties ) ) ; }
Create a model based on proposed schema
@param {string}  model_name - Name for the model
@param {object}  model_schema - Schema for the model
@param {Apollo~ModelCreationOptions} options - Options for the creation
@return {Model} Model constructor
Create a model based on proposed schema