Translixir.Model.Action (translixir v0.4.0) View Source
For tx_log functions it is necessary to create Actions.
This module is to assist on the creation of this Actions.
Link to this section Summary
Functions
Generates the proper encoding for Actions present in Action Agent
Adds a new Action (put, delete, match, evict) into the Action Agent
Creates a tx_log::delete with argument id, valid_time. Deletes a Document by id at a specific valid_time
Creates a tx_log::evict with argument id
Creates a tx_log::match with argument id, match, valid_time
Creates a new Action list
Creates a tx_log::put with argument id, value, valid_time. It inserts value in CruxDb
Link to this section Functions
Specs
actions(pid()) :: <<_::16, _::_*8>>
Generates the proper encoding for Actions present in Action Agent
actions =
Action.new()
|> Action.add_action(Action.evict(:hello))
|> Action.add_action(
Action.delete(:my_id, DateTime.from_naive!(~N[2020-10-10 13:26:08.003], "Etc/UTC"))
)
|> Action.add_action(
Action.put(:hello, %{name: "hello", age: 4300000000})
)
|> Action.actions()
actions == "[[:crux.tx/evict :hello] [:crux.tx/delete :my_id #inst "2020-10-10T13:26:08.003%2B00:00"]]"
Specs
Adds a new Action (put, delete, match, evict) into the Action Agent
Action.add_action(Action.new(), Action.evict(:hello))
Action.add_action(Action.new(), Action.delete(:hello))
Action.add_action(Action.new(), Action.put(:hello, %{name: "hello", age: 4300000000}))
Specs
Creates a tx_log::delete with argument id, valid_time. Deletes a Document by id at a specific valid_time
idcan beatomorintvalid_timeisDateTimeand optional
delete_date = Action.delete(:my_id, DateTime.from_naive!(~N[2020-10-10 13:26:08.003], "Etc/UTC"))
delete_date == "[:crux.tx/delete :my_id #inst "2020-10-10T13:26:08.003%2B00:00"]"
delete_no_date = Action.delete(:my_id)
delete_no_date == == "[:crux.tx/delete :my_id]"
Specs
Specs
Creates a tx_log::evict with argument id
idcan beatomorint
evict = Action.evict(:hello)
evict == "[:crux.tx/evict :hello]"
Specs
Creates a tx_log::match with argument id, match, valid_time
idcan beatomorintmatchmatching ednvalid_timeisDateTimeand optional
Specs
Specs
new() :: pid()
Creates a new Action list
Specs
Creates a tx_log::put with argument id, value, valid_time. It inserts value in CruxDb
idcan beatomorintvaluecan bestructormapvalid_timeisDateTimeand optional
put = Actions.put(3, %{first_name: "hello", last_name: "world"})
put == "[:crux.tx/put {:crux.db/id 3 :first_name "hello" :last_name "world"}]"
put_date = Actions.put(3, %User{first_name: "hello", last_name: "world"}, DateTime.from_naive!(~N[2020-10-10 13:26:08.003], "Etc/UTC"))
put_date == "[:crux.tx/put {:crux.db/id 3 :first_name "hello" :last_name "world"} #inst "2020-10-10T13:26:08.003%2B00:00"]"