Fluent CQL (fcql)
Allows fluent syntax for Cassandra Query Language (cql). Basically it creates CQL string queries from JavaScript code.
NOTE! Only CQL3 is supported.
Example:
var stringQuery = fcql;
results with
SELECT key, email, last_nameFROM user_profilesWHERE key = 'my_user';
Also raw strings work:
var stringQuery = fcql;
results the same as above.
For whom?
- The library validates given parameters so that you do less mistakes and code faster.
- The library helpful for CQL newbies. JSDoc supported functions will show you available options.
- The library allows partial query reuse (DRY). You can store 'SELECT...FROM...' and then add 'WHERE' as new query needed.
Usage
var fcql = ;
Creating tables
fcql;
results with
( name text, eventDate timestamp, device uuid, sensor int, description text, PRIMARY KEY ((name, eventDate), device, sensor));
Querying for data
fcql;
results with
SELECT something FROM somewhere WHERE aStringKey > '0' AND aStringKey <= '9' AND anIntKey = 123 AND aDateKey IN ('2069-07-21T00:37:33.589Z', '2037-11-11T22:50:53.589Z');
Want to contribute?
It is Open Open Source. Whoever sends a PR, which gets accepted, receives the write permissions.