Module: Dgraph

Defined in:
lib/dgraph.rb,
lib/dgraph/version.rb

Overview

D-graph ruby driver

Constant Summary collapse

VERSION =
'0.3.0'

Class Method Summary collapse

Class Method Details

.alter(operation_string) ⇒ Object

Altering database schema (needed for indexing, declaring reverse edges, etc) example: Dgraph.alter(“children: uid @reverse .”)



19
20
21
# File 'lib/dgraph.rb', line 19

def self.alter(operation_string)
  stub.alter(Api::Operation.new(schema: operation_string))
end

.mutate(query_string) ⇒ Object



9
10
11
# File 'lib/dgraph.rb', line 9

def self.mutate(query_string)
  stub.mutate(Api::Mutation.new(set_json: query_string, commit_now: true))
end

.query(query_string, vars = {}) ⇒ Object



13
14
15
# File 'lib/dgraph.rb', line 13

def self.query(query_string, vars = {})
  stub.query(Api::Request.new(query: query_string, vars: vars))
end

.stubObject



23
24
25
# File 'lib/dgraph.rb', line 23

def self.stub
  @stub ||= Api::Dgraph::Stub.new('0.0.0.0:9080', :this_channel_is_insecure)
end