Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/peburrows/diplomat
Elixir library for interacting with Google's Cloud Datastore
https://github.com/peburrows/diplomat
database elixir google-cloud-datastore
Last synced: about 1 month ago
JSON representation
Elixir library for interacting with Google's Cloud Datastore
- Host: GitHub
- URL: https://github.com/peburrows/diplomat
- Owner: peburrows
- Created: 2016-03-11T17:37:13.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-04-28T22:06:48.000Z (over 1 year ago)
- Last Synced: 2024-10-29T08:41:17.444Z (about 2 months ago)
- Topics: database, elixir, google-cloud-datastore
- Language: Elixir
- Size: 230 KB
- Stars: 94
- Watchers: 4
- Forks: 22
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - A [Google Cloud Datastore](https://cloud.google.com/datastore/) client. (Third Party APIs)
- fucking-awesome-elixir - diplomat - A [Google Cloud Datastore](https://cloud.google.com/datastore/) client. (Third Party APIs)
- awesome-elixir - diplomat - A [Google Cloud Datastore](https://cloud.google.com/datastore/) client. (Third Party APIs)
README
[![Build Status](https://travis-ci.org/peburrows/diplomat.svg?branch=master)](https://travis-ci.org/peburrows/diplomat)
# Diplomat
Diplomat is an Elixir library for interacting with Google's Cloud Datastore.
## Installation
1. Add datastore to your list of dependencies in `mix.exs`:
```elixir
def deps do
[{:diplomat, "~> 0.2"}]
end
```2. Make sure you've configured [Goth](https://github.com/peburrows/goth) with your credentials:
```elixir
config :goth,
json: {:system, "GCP_CREDENTIALS_JSON"}
```## Usage
#### Insert an Entity:
```elixir
Diplomat.Entity.new(
%{"name" => "My awesome book", "author" => "Phil Burrows"},
"Book",
"my-unique-book-id"
) |> Diplomat.Entity.insert
```#### Find an Entity via a GQL Query:
```elixir
Diplomat.Query.new(
"select * from `Book` where name = @name",
%{name: "20,000 Leagues Under The Sea"}
) |> Diplomat.Query.execute
```