Sha256: 3026c88daa8943a1d219a25aba0c44034eef7188ca9e9b9646e5d8be5e2be7a8

Contents?: true

Size: 899 Bytes

Versions: 4

Compression:

Stored size: 899 Bytes

Contents

# encoding: utf-8

module QueryBuilder::CQL

  module Contexts

    # Describes the Cassandra table index
    #
    class Index < Base

      attribute :table, required: true
      attribute :name

      # <description>
      #
      # @return [<type>] <description>
      #
      def to_s
        [table.keyspace.name, name].join(".")
      end

      # Builds the 'CREATE INDEX' CQL statement for the current table
      #
      # @param [Hash] options
      #
      # @return [QueryBuilder::Statements::CreateIndex]
      #
      def create(*options)
        Statements::CreateIndex.new(context: self).add(options)
      end

      # Builds the 'DROP INDEX' CQL statement
      #
      # @return [QueryBuilder::Statements::DropIndex]
      #
      def drop
        Statements::DropIndex.new(context: self)
      end

    end # class Index

  end # module Contexts

end # module QueryBuilder::CQL

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
query_builder-0.0.4 lib/query_builder/cql/contexts/index.rb
query_builder-0.0.3 lib/query_builder/cql/contexts/index.rb
query_builder-0.0.2 lib/query_builder/cql/contexts/index.rb
query_builder-0.0.1 lib/query_builder/cql/contexts/index.rb