Module: Diametric::Persistence::RestFunction

Defined in:
lib/diametric/persistence/rest_function.rb

Instance Method Summary collapse

Instance Method Details

#create_function(function_map, unused) ⇒ Object


4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/diametric/persistence/rest_function.rb', line 4

def create_function(function_map, unused)
  conn = Diametric::Persistence::REST.connection
  map = function_map.dup
  name = map.delete(:name)
  doc = map.delete(:doc)
  schema = {:"db/id" => Diametric::Persistence::REST.tempid(:"db.part/user"),
            :"db/ident" => name.to_sym}
  schema.merge!({:"db/fn" => EDN.tagged_element('db/fn', map)})
  if doc
    schema.merge!({:"db/doc" => doc})
  end
  result = conn.transact(Diametric::Persistence::REST.database, [schema]) # fails
end