git clone [email protected]:michaelwa/my_app.git
cd my_app
mix deps.get
mix compile
# initialize database
edgedb project init
# start ui
edgedb ui
- In the application started in your browser in the last step, click on the "Editor" icon in the left navbar.
- Paste in the code below
insert User {
name := "Michael"
}
- Then press CTRL+ENTER
- Create a new query and select the data back out again.
select User {
name
}
filter .name = "Michael"
- Note the following in the response window.
[
{
"name": "Michael"
}
]
> iex -S mix
- Start a EdgeDB client.
iex(1)> {:ok, client} = EdgeDB.start_link()
{:ok, #PID<0.463.0>}
- Query the data.
iex(2)> EdgeDB.query!(client, "select User { id, name, friends: { id, name, } }")
#EdgeDB.Set<{#EdgeDB.Object<id := "628da6f8-c2c2-11ee-82de-97b7577ea168", name := "Michael", friends := #EdgeDB.Set<{}>>}>
- Note: There is data.
- Now try running an :edge_ecto example.
iex(1)> MyApp.EdgeDB.Accounts.get_user_by_id("628da6f8-c2c2-11ee-82de-97b7577ea168")
** (EdgeDB.Error) InvalidArgumentError: value can not be encoded as object: "628da6f8-c2c2-11ee-82de-97b7577ea168"
(edgedb 0.6.1) lib/edgedb.ex:893: EdgeDB.unwrap!/1
(my_app 0.1.0) lib/my_app/edgedb.ex:2: MyApp.EdgeDB.Accounts.get_user_by_id/2
iex:1: (file)