Class: Droonga::Plugins::Groonga::Delete::Command

Inherits:
GenericCommand show all
Defined in:
lib/droonga/plugins/groonga/delete.rb

Instance Method Summary collapse

Methods inherited from GenericCommand

#execute, #initialize

Constructor Details

This class inherits a constructor from Droonga::Plugins::Groonga::GenericCommand

Instance Method Details

#process_request(request) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/droonga/plugins/groonga/delete.rb', line 26

def process_request(request)
  command_class = ::Groonga::Command.find("delete")
  @command = command_class.new("delete", request)

  table_name = valid_table_name("table", :error_result => false)

  key = @command["key"]
  id = @command["id"]
  filter = @command["filter"]

  validate_parameters(key, id, filter)

  table = @context[table_name]
  if key
    delete_record_by_key(table, key)
  elsif id
    delete_record_by_id(table, id)
  else
    delete_record_by_filter(table, filter)
  end

  true
end