Sha256: c478e4299815860d017d8e771530f591564e81f2393c2fd95144a000c832ca59

Contents?: true

Size: 892 Bytes

Versions: 4

Compression:

Stored size: 892 Bytes

Contents

# encoding: utf-8

module QueryBuilder::CQL

  module Contexts

    # Describes the user-defined trigger for the table
    #
    class Trigger < Base

      attribute :table, required: true
      attribute :name,  required: true

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

      # Builds the 'CREATE TRIGGER' CQL statement for the current trigger
      #
      # @return [QueryBuilder::Statements::CreateTrigger]
      #
      def create
        Statements::CreateTrigger.new(context: self)
      end

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

    end # class Trigger

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