CQL data adapters for Magic and Hyperlambda
This project provides Magic and Hyperlambda with CQL data adapters, allowing you to perform CRUD operations towards for instance Cassandra or ScyllaDB.
Slots
The project contains the following slots.
- [cql.connect] - Creates a session towards a CQL cluster
- [cql.execute] - Executes some CQL statement towards an open session and returns the result to caller
The basic idea of the slots are to allow for things such as follows.
cql.connect:[generic|space]
cql.select:"select * from table where column = 'foo/bar'"
Where the generic
parts above is a reference to a cluster you’ll have to configure in your “appsettings.json”,
while the space
parts above is a keyspace within that cluster. In such a regard the slots resembles the generic
RDBMS slots in usage, except of course it opens a connection towards a NoSQL database such as Cassandra or ScyllaDB,
and returns the result of executing your SQL towards a keyspace within that cluster. To use parameters in your CQL
you can use something resembling the following.
cql.connect:[generic|space]
cql.select:"select * from table where column1 = :foo and column2 = :bar"
foo:bar
bar:x:@.arguments/*/some-arg
The way arguments are resolved is that in the above example :foo
becomes a reference to the [foo]
node’s value, and/or expression’s value.
Configuration
The primary configuration for the project to apply for your “appsettings.json” file can be found below.
{
"magic": {
"cql": {
"generic": {
"host": "127.0.0.1"
}
}
}
}
The above configures the adapter to use 127.0.0.1
as the host for your generic
contact point or cluster.
You can add as many cluster connection points as you want to, and reference these using their unique names.
Project website
The source code for this repository can be found at github.com/polterguy/magic.lambda.cql, and you can provide feedback, provide bug reports, etc at the same place.