Sha256: e9090415389f67ae3b16918c2996f1d8ce9125b91305911bb3fdbe18dc915e33

Contents?: true

Size: 1.72 KB

Versions: 4

Compression:

Stored size: 1.72 KB

Contents

# encoding: utf-8

module QueryBuilder

  require_relative "cql/operators"
  require_relative "cql/contexts"
  require_relative "cql/modifiers"
  require_relative "cql/statements"

  # The builder for CQL-specific statements
  #
  module CQL

    # Returns the context of Cassandra keyspace
    #
    # @param [#to_s] name The name of the keyspace
    #
    # @param [QueryBuilder::CQL::Contexts::Keyspace]
    #
    def self.keyspace(name)
      Contexts::Keyspace.new(name: name)
    end

    # Returns the context of Cassandra user
    #
    # @param [#to_s] name The name of the user
    #
    # @param [QueryBuilder::CQL::Contexts::User]
    #
    def self.user(name)
      Contexts::User.new(name: name)
    end

    # Returns the context of Cassandra users role
    #
    # @param [#to_s] name The name of the role
    #
    # @param [QueryBuilder::CQL::Contexts::Role]
    #
    def self.role(name)
      Contexts::Role.new(name: name)
    end

    # Returns the context of Cassandra root permission
    #
    # @param [#to_s, nil] name The name of the permission
    #
    # @param [QueryBuilder::CQL::Contexts::Permission]
    #
    def self.permission(name = nil)
      Contexts::Permission.new(name: name)
    end

    # Builds the 'LIST USERS' CQL statement
    #
    # @return [QueryBuilder::Statements::ListUsers]
    #
    def self.users
      Statements::ListUsers.new
    end

    # Builds the 'LIST ROLES' CQL statement
    #
    # @return [QueryBuilder::Statements::ListRoles]
    #
    def self.roles
      Statements::ListRoles.new
    end

    # Builds the 'BATCH' CQL statement
    #
    # @return [QueryBuilder::Statements::Batch]
    #
    def self.batch
      Statements::Batch.new
    end

  end # module CQL

end # module QueryBuilder

Version data entries

4 entries across 4 versions & 1 rubygems

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