cassandra

Bindings to Cassandra DB driver

Wrapper score 30/100 · tests present · docs generated

Wraps a native library — check OS Compatibility below for platform-specific linking notes.

Summary

Latest Version Unknown
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-07-21 05:24

Installation

nimble install cassandra
choosenim install cassandra
git clone https://github.com/yglukhov/cassandra

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
cassandra - - - - - - -

Source

Repository https://github.com/yglukhov/cassandra
Homepage https://github.com/yglukhov/cassandra
Documentation View Documentation
Registry Source nimble_official

README

cassandra Build Status

Nim bindings to cassandra db driver

Usage

import asyncdispatch, cassandra

proc test() {.async.} =
    let cluster = newCluster()
    let session = newSession()

    # Add contact points
    cluster.setContactPoints("127.0.0.1")

    # Provide the cluster object as configuration to connect the session
    discard await session.connect(cluster)
    echo "Connected"

    let statement = newStatement("SELECT * FROM system.schema_keyspaces WHERE keyspace_name = ?")
    statement[0] = "system"
    let res = await session.execute(statement)
    let val = res.firstRow.columns["strategy_class"]
    let cl = val.string
    echo "result: ", val
    assert(cl == "org.apache.cassandra.locator.LocalStrategy")

waitFor test()

Lower level

While high level bindings are still in development you can use low level bindings generated directly from cassandra.h. You can always take underlying binding type value from higher level api types. As an option, contributions are welcome ;)

Example of mixing two APIs:

import cassandra
import cassandra/bindings # Low-level bindings
let cluster = newCluster()
let session = newSession()

# Add contact points
discard cass_cluster_set_contact_points(cluster.o, "127.0.0.1") # Note: .o is the low-level type

Dependencies

  • libcassandra - most likely, you'll have to build it yourself
  • libuv - check out your package manager, most likely it will be there