Class: EventStoreClient::GRPC::Commands::Projections::Update

Inherits:
Command
  • Object
show all
Defined in:
lib/event_store_client/adapters/grpc/commands/projections/update.rb

Instance Method Summary collapse

Methods inherited from Command

inherited, #metadata

Methods included from Configuration

#config

Instance Method Details

#call(name, streams) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/event_store_client/adapters/grpc/commands/projections/update.rb', line 17

def call(name, streams)
  data = "    fromStreams(\#{streams})\n    .when({\n      $any: function(s,e) {\n        linkTo(\"\#{name}\", e)\n      }\n    })\n  STRING\n\n  options =\n    {\n      query: data,\n      name: name,\n      emit_enabled: true\n    }\n  service.update(request.new(options: options), metadata: metadata)\n  Success()\nrescue ::GRPC::AlreadyExists\n  Failure(:conflict)\nend\n"