-
fix and enhance support for custom ecto types (see example
Dlex.Geo
in tests) -
fix a types diff not handled proparly in
Dlex.Repo
in alter_schema -
enahnce decoding/encoding in
Dlex.Repo
to return errors -
enhance
Repo.all
to accept query parameters. To enableRepo.all
automatically detect types and converts to types, please include at leastdgraph.type
. Recommended query returns:uid dgraph.type expand(_all_)
- enahnce
mutate
API to support multiple mutations and set and delete combined - do not sent invalid changeset data to DGraph
- fix creation of geo locations with
return_json: true
option - add support for
best_effort
andread_only
options for query
Backwards-incompatible changes:
Dlex.mutate
changed. Before:Dlex.mutate(pid, %{query: query, condition: condition}, mutation, opts)
, now this changed toDlex.mutate(pid, %{query: query}, %{cond: condition, set: mutation}, opts)
. It allows now to combineset
anddelete
in the same mutation and do multiple mutations in one:Dlex.mutate(pid, %{query: query}, %{cond: condition, set: set, delete: delete}, opts)
Dlex.mutate(pid, %{query: query}, [mutaion1, mutation2])
Dlex.set
now doesn't acceptcondition
in a query,Dlex.mutate
should be used instead.Dlex.mutate
,Dlex.delete
,Dlex.set
doesn't return uids or json directly, but adds it to a map:%{uids: uids, json: json}
and additionally it has has keyqueries
to return queries, which additionally were used for this mutation. This allows to get everything back, what DGraph returns.
- check dgraph 1.1.1 is supported
- fix upserts for http protocol
- Add support for conditions in upsert
- Add support for returning structs in Repo.all
Backwards-incompatible changes:
Dlex.mutate(pid, query, mutation, opts)
is nowDlex.mutate(pid, %{query: query}, mutation, opts)
, additionallyDlex.mutate(pid, %{query: query, condition: condition}, mutation, opts)
Repo.all
defined viaDlex.Repo
- could return structs(if type is defined) instead of pure jsons
- Rename dgraph.type to be without prefix
type.
as it do not needed anymore
- Add http support for DGraph
1.1.0
As dgraph has breaking API change, this version supports DGraph only in version 1.1.0
, use
dlex in version 0.2.1
for using with DGraph 1.0.X
.
- support DGraph
1.1.0
(only forgrpc
at the moment)
- add support for upcoming
upsert
functionallity (only forgrpc
) - fix dependency missconfiguration in
v0.2.0
- fix leaking of gun connections on timeouts
- add
transport
option, which specifies ifgrpc
orhttp
transport should be used - make
grpc
dependencies optional, so you can choose based on transport the dependencies
- add support to alter table in the same format (json) as it queried. Now you can use output of
Dlex.query_schema
inDlex.alter
.
Example of usage:
Dlex.alter(conn, [%{
"index" => true,
"predicate" => "user.name",
"tokenizer" => ["term"],
"type" => "string"
}])
- add initial basic language integrated features on top of dgraph adapter:
- add
Dlex.Node
to define schemas - add
Dlex.Repo
to define something likeEcto.Repo
, but specific for Dgraph with custom API Dlex.Repo
supportsEcto.Changeset
(andDlex.Node
schemas supportsEcto.Changeset
), ecto is optional
- add
Example usage:
defmodule User do
use Dlex.Node
schema "user" do
field :name, :string, index: ["term"]
field :age, :integer
field :owns, :uid
end
end
defmodule Repo do
use Dlex.Repo, otp_app: :test, modules: [User]
end
%User{uid: uid} = Repo.mutate!(%User{name: "Alice", age: 29})
%User{name: "Alice"} = Repo.get!(uid)
Casting of nodes to structs happens automatically, but you need to either specify module in
modules
or register them once after Repo
is started with Repo.register(User)
to be
available for Repo
.
To get User
schema, can be User.__schema__(:alter)
used or Repo.snapshot
for all fields or
or Repo.alter_schema()
to directly migrate/alter schema for Repo
.
Ecto.Changeset
works with Dlex.Node
and Dlex.Repo
.
Example usage:
changeset = Ecto.Changeset.cast(%User{}, %{"name" => "Alice", "age" => 20}, [:name, :age])
Repo.mutate(changeset)
- add timeout on grpc calls
- ensure client reconnection works on dgraph unavailibility
- optimize json encoding/decoding, fetch json library from environment on connection start
- fix adding default options by including as supervisor
First release!