riptide v0.3.13 Riptide
The primary Riptide module
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Convience method to apply a mutation that deletes a single path
The same as delete/2
but raises an exception if it fails
Convience method to apply a mutation that merges a single value
The same as merge/3
but raises an exception if it fails
Apply a mutation. This will do following steps in order
The same as mutation/2
but raises an exception if it fails
Pass in a query and get the results.
Return data under a specific path
The same as query_path/3
but raises an exception if it fails
Starts a Riptide process.
Return a stream of values underneath a path
Link to this section Functions
child_spec(init_arg)
Returns a specification to start this module under a supervisor.
See Supervisor
.
delete(path, state \\ %{internal: true})
Convience method to apply a mutation that deletes a single path
Examples
iex> Riptide.put_delete(["foo", "bar"])
{:ok, %{
delete: %{
"foo" => %{
"bar" => 1
}
},
delete: %{}
}}
delete!(path, state \\ %{internal: true})
The same as delete/2
but raises an exception if it fails
merge(path, value, state \\ %{internal: true})
Convience method to apply a mutation that merges a single value
Examples
iex> Riptide.put_merge(["foo", "bar"], "hello")
{:ok, %{
merge: %{
"foo" => %{
"bar" => "hello
}
},
delete: %{}
}}
merge!(path, value, state \\ %{internal: true})
The same as merge/3
but raises an exception if it fails
mutation(mut, state \\ %{internal: true})
mutation(Riptide.Mutation.t(), any()) :: {:ok, Riptide.Mutation.t()} | {:error, any()}
Apply a mutation. This will do following steps in order
- Trigger
Riptide.Interceptor.mutation_before/4
- Trigger
Riptide.Interceptor.mutation_effect/4
- Broadcast mutation to interested processes
- Write mutation to stores
- Trigger
Riptide.Interceptor.mutation_after/4
Examples
iex> Riptide.mutation(Riptide.Mutation.put_merge(["foo", "bar"], "hello"))
{:ok, %{
merge: %{
"foo" => %{
"bar" => "hello
}
},
delete: %{}
}}
mutation!(mut, state \\ %{internal: true})
The same as mutation/2
but raises an exception if it fails
query(query, state \\ %{internal: true})
Pass in a query and get the results.
Read more about query structure here. State parameter is optional and is passed to interceptors.
Options
:min
- Starting range of query, optional:max
- End range of query, optional:limit
- Max number of results, optional
Examples
iex> Riptide.query(%{ "todo:info" => %{} })
%{
"todo:info" => %{
"todo1" => %{
"text" => "Document riptide"
}
}
}
query_path(path, opts \\ %{}, state \\ %{internal: true})
Return data under a specific path
Options
:min
- Starting range of query, optional:max
- End range of query, optional:limit
- Max number of results, optional
query_path!(path, opts \\ %{}, state \\ %{internal: true})
The same as query_path/3
but raises an exception if it fails
start_link(opts \\ [])
Starts a Riptide process.
Probably should not called this directly and instead should be placed inside your application's root supervisor.
Options
:port
- Optional, will override default port of12_000
stream(path, opts \\ %{}, state \\ %{internal: true})
Return a stream of values underneath a path
Options
:min
- Starting range of query, optional:max
- End range of query, optional:limit
- Max number of results, optional
Examples
iex> Riptide.stream(["todo:info"]) |> Enum.take(1)
[
%{"todo1", %{ "text" => "Document riptide" }}
]