Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cassandra_db

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cassandra_db

  • 1.0.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

CassandraDB

Gem Version CI Coverage Status Code Climate

Cassandra DB adapter inspired on Sequel

Installation

Add this line to your application's Gemfile:

gem 'cassandra_db'

And then execute:

$ bundle

Or install it yourself as:

$ gem install cassandra_db

Usage

Connect

db = CassandraDB.connect hosts: ['localhost'], port: 9042, keyspace: 'system'

Metadata

db.keyspace # => :system

db.keyspaces # => [:system, :system_traces]

db.tables # => Array of table names in current keyspace

Change keyspace

db.use_keyspace 'my_keyspace'
db.keyspace # => :my_keyspace

Create and drop keyspaces

replication_opts = {
  class: 'SimpleStrategy',
  replication_factor: 1
}
db.create_keyspace :my_keyspace, replication: replication_opts, durable_writes: true

db.drop_keyspace :my_keyspace

Queries

dataset = db[table_name] # => CassandraDB::Dataset
dataset = db[table_name].where(field: 'value') # => CassandraDB::Dataset

Dataset/Enumerable methods

dataset.count
dataset.each
dataset.map
dataset.all

Insert, Update, Delete

dataset.insert id: 1, name: 'Name 1'

dataset.where(id: 1).update name: 'Name 2'

dataset.where(id: 1).delete

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/gabynaiman/cassandra_db.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 22 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc