Diplomat is an Elixir library for interacting with Google's Cloud Datastore.
- Add datastore to your list of dependencies in
mix.exs
:
def deps do
[{:diplomat, "~> 0.2"}]
end
- Make sure you've configured Goth with your credentials:
config :goth,
json: {:system, "GCP_CREDENTIALS_JSON"}
Diplomat.Entity.new(
%{"name" => "My awesome book", "author" => "Phil Burrows"},
"Book",
"my-unique-book-id"
) |> Diplomat.Entity.insert
Diplomat.Query.new(
"select * from `Book` where name = @name",
%{name: "20,000 Leagues Under The Sea"}
) |> Diplomat.Query.execute