examples/keyspaces.rb in cassanity-0.3.0 vs examples/keyspaces.rb in cassanity-0.4.0

- old
+ new

@@ -1,25 +1,22 @@ require_relative '_shared' require 'cassanity' -client = CassandraCQL::Database.new('127.0.0.1:9160', { - cql_version: '3.0.0', +client = Cassanity::Client.new('127.0.0.1:9160', { + instrumenter: ActiveSupport::Notifications, }) -executor = Cassanity::Executors::CassandraCql.new(client: client) -connection = Cassanity::Connection.new(executor: executor) - # gets instance of keyspace -keyspace = connection['cassanity_examples'] +keyspace = client['cassanity_examples'] # or you can do this... -keyspace = connection.keyspace('cassanity_examples') +keyspace = client.keyspace('cassanity_examples') pp keyspace # you can also provide options -keyspace = connection.keyspace('cassanity_examples', { +keyspace = client.keyspace('cassanity_examples', { strategy_class: 'SimpleStrategy', strategy_options: { replication_factor: 1, }, }) @@ -35,19 +32,17 @@ # 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_schema = Cassanity::Schema.new({ - primary_key: :id, - columns: { - id: :text, - name: :text, - }, -}) - apps = keyspace.column_family('apps', { - schema: apps_schema, + schema: { + primary_key: :id, + columns: { + id: :text, + name: :text, + }, + }, }) pp apps # that was basically just a shortcut for this apps = Cassanity::ColumnFamily.new({