Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
23 lines (15 sloc) 513 Bytes
#!/usr/bin/env ruby
require 'datomic/client'
require 'edn'
require 'pry'
require './common'
datomic = Datomic::Client.new 'http://localhost:9000', 'example'
dbname = 'customers'
Q_EMAILS = '[:find ?c :in $data :where [$data ?c :customer/email _]]'
puts "Sending emails at #{DateTime.now}"
puts
query_response = datomic.query(Q_EMAILS, 'customers')
puts "Query response: #{query_response.data}"
puts
entities = query_response.data.flatten.map {|id| datomic.entity(dbname, id).data}
print_entities(entities)