Sha256: 5c30266e8115d8f32fc32201cab0efd041a3fba906967c810b3b4b199cdc4f43

Contents?: true

Size: 995 Bytes

Versions: 4

Compression:

Stored size: 995 Bytes

Contents

# encoding: utf-8

module QueryBuilder::CQL

  module Contexts

    # Describes the Cassandra user-defined function
    #
    class Function < Base

      attribute :keyspace, required: true
      attribute :name, required: true

      # Returns the full name of the function
      #
      # @return [String]
      #
      def to_s
        [keyspace, name].join(".")
      end

      # Builds the 'CREATE FUNCTION' CQL statement
      #
      # @param [#to_s] language
      # @param [#to_s] body
      #
      # @return [QueryBuilder::Statements::CreateFunction]
      #
      def create(language, body)
        Statements::CreateFunction
          .new(context: self, language: language, body: body)
      end

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

    end # class Function

  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/function.rb
query_builder-0.0.3 lib/query_builder/cql/contexts/function.rb
query_builder-0.0.2 lib/query_builder/cql/contexts/function.rb
query_builder-0.0.1 lib/query_builder/cql/contexts/function.rb