View Source Ravix.Documents.Session (ravix v0.0.2)
A stateful session to execute ravendb commands
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Marks the document for deletion
Executes a query into the RavenDB
Fetches the current session state
Callback implementation for GenServer.handle_continue/2
.
Callback implementation for GenServer.init/1
.
Loads the document from the database to the local session
Persists the session changes to the RavenDB database
Add a document to the session to be created
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Marks the document for deletion
parameters
Parameters
- session_id: the session id
- entity: the document to be deleted
returns
Returns
{:ok, updated_state}
{:error, cause}
Executes a query into the RavenDB
paremeters
Paremeters
- query: The
Ravix.RQL.Query
to be executed - session_id: the session_id
- method: The http method
@spec fetch_state(binary()) :: {:error, :session_not_found} | {:ok, Ravix.Documents.Session.State.t()}
Fetches the current session state
Callback implementation for GenServer.handle_continue/2
.
Callback implementation for GenServer.init/1
.
Loads the document from the database to the local session
parameters
Parameters
- session_id: the session_id
- ids: the document ids to be loaded
- includes: the document includes path
- opts: load options
returns
Returns
{:ok, results}
{:errors, cause}
Persists the session changes to the RavenDB database
@spec start_link(any(), Ravix.Documents.Session.State.t()) :: :ignore | {:error, any()} | {:ok, pid()}
Add a document to the session to be created
parameters
Parameters
- session_id: the session id
- entity: the document to store
- key: the document key to be used
- change_vector: the concurrency change vector
returns
Returns
{:ok, updated_session}
{:error, cause}