Translixir (translixir v0.1.1) View Source
Documentation for Translixir
.
Link to this section Summary
Functions
entity({:ok, <PID>}, entity_crux_id)
POST an ID at CruxDB endpoint /entity
entity!(<PID>, entity_crux_id)
POST an ID at CruxDB endpoint /entity
entity_tx({:ok, <PID>}, entity_crux_id)
POST an ID at CruxDB endpoint /entity-tx
entity_tx!(<PID>, entity_crux_id)
POST an ID at CruxDB endpoint /entity-tx
tx_log({:ok, <PID>}, actions)
POST a collection of Action
at CruxDB endpoint /tx-log
tx_log!(<PID>, actions)
POST a collection of Action
at CruxDB endpoint /tx-log
tx_logs({:ok, <PID>})
GET at CruxDB endpoint /tx-log
tx_logs!(<PID>)
GET at CruxDB endpoint /tx-log
Link to this section Functions
Specs
entity({:ok, <PID>}, entity_crux_id)
POST an ID at CruxDB endpoint /entity
Returns:
status_2XX
-> {:ok, body}
_ -> {:error}
Example entity_crux_id
":jorge-3"
Example Response:
{:ok, { :crux.db/id :jorge-3, :first-name "Michael", :last-name "Jorge", }}
entity!(<PID>, entity_crux_id)
POST an ID at CruxDB endpoint /entity
Returns:
status_2XX
-> body
_ -> exception is raised
Example entity_crux_id
":jorge-3"
Example Response:
{ :crux.db/id :jorge-3, :first-name "Michael", :last-name "Jorge", }
Specs
entity_tx({:ok, <PID>}, entity_crux_id)
POST an ID at CruxDB endpoint /entity-tx
Returns:
status_2XX
-> {:ok, body}
_ -> {:error}
Example entity_crux_id
":jorge-3"
Example Response:
{:ok, "{:crux.db/id #crux/id "be21bd5ae7f3334b9b8abb185dfbeae1623088b1", :crux.db/content-hash #crux/id "9d2c7102d6408d465f85b0b35dfb209b34daadd1", :crux.db/valid-time #inst "2020-10-16T01:51:50.568-00:00", :crux.tx/tx-time #inst "2020-10-16T01:51:50.568-00:00", :crux.tx/tx-id 4}"}
entity_tx!(<PID>, entity_crux_id)
POST an ID at CruxDB endpoint /entity-tx
Returns:
status_2XX
-> body
_ -> exception is raised
Example entity_crux_id
":jorge-3"
Example Response:
"{:crux.db/id #crux/id "be21bd5ae7f3334b9b8abb185dfbeae1623088b1", :crux.db/content-hash #crux/id "9d2c7102d6408d465f85b0b35dfb209b34daadd1", :crux.db/valid-time #inst "2020-10-16T01:51:50.568-00:00", :crux.tx/tx-time #inst "2020-10-16T01:51:50.568-00:00", :crux.tx/tx-id 4}"
Specs
tx_log({:ok, <PID>}, actions)
POST a collection of Action
at CruxDB endpoint /tx-log
Usage:
put = action(:put, "{ :crux.db/id :jorge-3, :first-name "Michael", :last-name "Jorge", }")
Client.new("localhost", "3000")
|> tx_log(put)
|> IO.inspect
Returns:
status_2XX
-> {:ok, body}
_ -> {:error}
Example Action
{ :crux.db/id :jorge-3, :first-name "Michael", :last-name "Jorge", }
Example Response:
{:ok, "{:crux.tx/tx-id 7, :crux.tx/tx-time #inst "2020-07-16T21:50:39.309-00:00"}"}
Specs
tx_log!(<PID>, actions)
POST a collection of Action
at CruxDB endpoint /tx-log
Returns:
status_2XX
-> body
_ -> exception is raised
Specs
tx_logs({:ok, <PID>})
GET at CruxDB endpoint /tx-log
Returns:
status_2XX
-> {:ok, body}
_ -> {:error}
Example Response:
{:ok,
({:crux.tx/tx-id 0, :crux.tx/tx-time #inst "2020-10-14T03:48:43.298-00:00", :crux.tx.event/tx-events
[[:crux.tx/put #crux/id "be21bd5ae7f3334b9b8abb185dfbeae1623088b1" #crux/id "9d2c7102d6408d465f85b0b35dfb209b34daadd1"]]}
{:crux.tx/tx-id 1, :crux.tx/tx-time #inst "2020-10-16T01:10:08.451-00:00", :crux.tx.event/tx-events
[[:crux.tx/put #crux/id "be21bd5ae7f3334b9b8abb185dfbeae1623088b1" #crux/id "9d2c7102d6408d465f85b0b35dfb209b34daadd1"]]})}
Specs
tx_logs!(<PID>)
GET at CruxDB endpoint /tx-log
Returns:
status_2XX
-> body
_ -> exception is raised