Sha256: c3d95f3f7719092033f72a48ae6ad9aa6c0f1149dcb7750a531ae0d362259f0a
Contents?: true
Size: 1.08 KB
Versions: 6
Compression:
Stored size: 1.08 KB
Contents
require_relative '_shared' require 'cassanity' client = Cassanity::Client.new('127.0.0.1:9160', { instrumenter: ActiveSupport::Notifications, }) # gets instance of keyspace keyspace = client['cassanity_examples'] # or you can do this... keyspace = client.keyspace('cassanity_examples') pp keyspace # you can also provide options keyspace = client.keyspace('cassanity_examples', { replication: { class: 'SimpleStrategy', replication_factor: 1, }, }) # drop keyspace if it exists keyspace.drop if keyspace.exists? # create the keyspace, uses options from above keyspace.create # use this keyspace keyspace.use apps_schema = { primary_key: :id, columns: { id: :text, name: :text, }, } # get an instance of a column family apps = keyspace.column_family('apps') # you can also pass a schema so the column family is all knowing apps = keyspace.column_family('apps', { schema: apps_schema, }) pp apps # that was basically just a shortcut for this apps = Cassanity::ColumnFamily.new({ name: 'apps', keyspace: keyspace, schema: apps_schema, }) pp apps keyspace.recreate
Version data entries
6 entries across 6 versions & 1 rubygems