Constructor
new Model(db, name, schema, callback)
Parameters:
Name | Type | Description |
---|---|---|
db |
object | the database connection instance |
name |
string | the model name, will become the name of the column family |
schema |
object | the Cassandra.Schema to be attached |
callback |
function | a callback to be called once the table has been created |
Example
Attach a schema to a model for querying
var cassandra = Cassandra.connect(...);
var testSchema = new Cassandra.Schema(...);
var testModel = new Cassandra.Model(cassandra, 'test', testSchema);
Classes
Methods
_createPartitionKeyQuery(primaryKeyArray)
Given a primary key array object, this will convert it to a
PRIMARY KEY (...) string value to use in table creation
Parameters:
Name | Type | Description |
---|---|---|
primaryKeyArray |
array | An array specifying the primary key columns, can be compound and composite as well |
_qualifyQueryColumns(queryObject) → {array}
Checks the queryObject's properties against the qualified columns
Parameters:
Name | Type | Description |
---|---|---|
queryObject |
object | an object representing column:value |
Throws:
Error - not a valid query column
Returns:
columns - a list of qualified columns
- Type
- array