View Source surreal (surreal v1.0.0)

Base module of the library.

Link to this section Summary

Functions

Authenticates the current connection with a JWT token.
Change all records in a table, or a specific record.
Close connection.
Creates a record in the database.
Deletes all records in a table, or a specific record, from the database.
Invalidates the authentication for the current connection.
Applies JSON Patch changes to all records in a table, or a specific record.
Runs a set of SurrealQL statements against the database.
Runs a set of SurrealQL statements against the database with parameters.
Selects all records in a table, or a specific record, from the database.
Signs in to a specific authentication scope.
Signs up to a specific authentication scope.
Same with "start_link" but without linking process.
Connects to a local or remote database endpoint.
Updates all records in a table, or a specific record.
Switch to a specific namespace and database.

Link to this section Functions

Link to this function

authenticate(Connection, Token)

View Source
-spec authenticate(Connection :: pid(), Token :: string()) -> surreal_response:result().
Authenticates the current connection with a JWT token.
Link to this function

change(Connection, TableOrId, Data)

View Source
-spec change(Connection :: pid(), TableOrId :: string(), Data :: map()) -> surreal_response:result().
Change all records in a table, or a specific record.
-spec close(Connection :: pid()) -> shutdown_ok.
Close connection.
Link to this function

create(Connection, TableOrId, Data)

View Source
-spec create(Connection :: pid(), TableOrId :: string(), Data :: map()) -> surreal_response:result().
Creates a record in the database.
Link to this function

delete(Connection, TableOrId)

View Source
-spec delete(Connection :: pid(), TableOrId :: string()) -> surreal_response:result().
Deletes all records in a table, or a specific record, from the database.
-spec invalidate(Connection :: pid()) -> surreal_response:result().
Invalidates the authentication for the current connection.
Link to this function

modify(Connection, TableOrId, Data)

View Source
-spec modify(Connection :: pid(), TableOrId :: string(), Data :: map()) -> surreal_response:result().
Applies JSON Patch changes to all records in a table, or a specific record.
Link to this function

query(Connection, Query)

View Source
-spec query(Connection :: pid(), Query :: string()) -> surreal_response:result().
Runs a set of SurrealQL statements against the database.
Link to this function

query(Connection, Query, Params)

View Source
-spec query(Connection :: pid(), Query :: string(), Params :: map()) -> surreal_response:result().
Runs a set of SurrealQL statements against the database with parameters.
Link to this function

select(Connection, TableOrId)

View Source
-spec select(Connection :: pid(), TableOrId :: string()) -> surreal_response:result().
Selects all records in a table, or a specific record, from the database.
Link to this function

signin(Connection, User, Pass)

View Source
-spec signin(Connection :: pid(), User :: string(), Pass :: string()) -> surreal_response:result().
Signs in to a specific authentication scope.
Link to this function

signup(Connection, Namespace, Database, Scope, Email, Password)

View Source
-spec signup(Connection :: pid(),
       Namespace :: string(),
       Database :: string(),
       Scope :: string(),
       Email :: string(),
       Password :: string()) ->
          surreal_response:result().
Signs up to a specific authentication scope.
-spec start(Url :: string()) -> {ok, pid()} | {error, term()}.
Same with "start_link" but without linking process.
-spec start_link(Url :: string()) -> {ok, pid()} | {error, term()}.
Connects to a local or remote database endpoint.
Link to this function

update(Connection, TableOrId, Data)

View Source
-spec update(Connection :: pid(), TableOrId :: string(), Data :: map()) -> surreal_response:result().
Updates all records in a table, or a specific record.
Link to this function

use(Connection, Namespace, Database)

View Source
-spec use(Connection :: pid(), Namespace :: string(), Database :: string()) -> surreal_response:result().
Switch to a specific namespace and database.