suweal/http/surreal_http
Types
pub type AuthenticationBody {
AuthenticationBody(
db: String,
ns: String,
ac: String,
email: String,
password: String,
data: List(#(String, surreal_ql.SurrealQL)),
)
}
Constructors
-
AuthenticationBody( db: String, ns: String, ac: String, email: String, password: String, data: List(#(String, surreal_ql.SurrealQL)), )
Values
pub fn authentication_body(
connection: suweal.Connection,
table: String,
email: String,
password: String,
content: List(#(String, surreal_ql.SurrealQL)),
) -> AuthenticationBody
pub fn get_record(
connection: suweal.Connection,
table: String,
id: identifier.Identifier(a),
decoder: decode.Decoder(a),
) -> Result(a, suweal.SurrealError)
The get record endpoint selects a specific record in a specific table in the database.
The equivalent query is:
SELECT * FROM type::record($table, $id);
This is the simplified version of get_record_raw which already extracts the result.
https://surrealdb.com/docs/reference/rest-api/http-protocol#get-record
pub fn get_record_raw(
connection: suweal.Connection,
table: String,
id: identifier.Identifier(a),
decoder: decode.Decoder(a),
) -> Result(
List(suweal.SurrealResponse(List(a))),
suweal.SurrealError,
)
The get record endpoint selects a specific record in a specific table in the database.
The equivalent query is:
SELECT * FROM type::record($table, $id);
Consider using the get_record function instead if you don’t need the raw response, as it will
simplify the result handling.
https://surrealdb.com/docs/reference/rest-api/http-protocol#get-record
pub fn get_records(
connection: suweal.Connection,
table: String,
decoder: decode.Decoder(a),
) -> Result(
List(suweal.SurrealResponse(List(a))),
suweal.SurrealError,
)
The endpoint to select all records in a specific table in the database.
The equivalent query is:
SELECT * FROM type::table($table);
https://surrealdb.com/docs/reference/rest-api/http-protocol#get-table
pub fn health(connection: suweal.Connection) -> Result(Nil, Nil)
The health endpoint returns a simple response indicating the health of the SurrealDB server. https://surrealdb.com/docs/reference/rest-api/http-protocol#health
pub fn health_request(
connection: suweal.Connection,
) -> Result(request.Request(String), Nil)
The health endpoint returns a simple response indicating the health of the SurrealDB server. https://surrealdb.com/docs/reference/rest-api/http-protocol#health
pub fn post_record(
connection: suweal.Connection,
table: String,
id: identifier.Identifier(a),
content: surreal_ql.SurrealQL,
decoder: decode.Decoder(a),
) -> Result(
List(suweal.SurrealResponse(List(a))),
suweal.SurrealError,
)
Creates a record in a specific table in the database.
The equivalent query is:
CREATE type::table($id, $table) CONTENT $data;
https://surrealdb.com/docs/reference/rest-api/http-protocol#post-record
pub fn post_table(
connection: suweal.Connection,
table: String,
content: surreal_ql.SurrealQL,
decoder: decode.Decoder(a),
) -> Result(
List(suweal.SurrealResponse(List(a))),
suweal.SurrealError,
)
The endpoint to create a new record in a specific table in the database.
The equivalent query is:
CREATE type::table($table) CONTENT $data;
https://surrealdb.com/docs/reference/rest-api/http-protocol#post-table
pub fn ready(connection: suweal.Connection) -> Result(Nil, Nil)
The ready endpoint returns a simple response indicating the readiness of the SurrealDB server. https://surrealdb.com/docs/reference/rest-api/http-protocol#ready
pub fn ready_request(
connection: suweal.Connection,
) -> Result(request.Request(String), Nil)
The ready endpoint returns a simple response indicating the readiness of the SurrealDB server. https://surrealdb.com/docs/reference/rest-api/http-protocol#ready
pub fn run_sql(
connection: suweal.Connection,
query: String,
parameters: List(#(String, surreal_ql.SurrealQL)),
decoder: decode.Decoder(a),
) -> Result(List(suweal.SurrealResponse(a)), suweal.SurrealError)
The SQL endpoint enables use of SurrealQL queries.
https://surrealdb.com/docs/reference/rest-api/http-protocol#sql
pub fn signin(
connection: suweal.Connection,
table: String,
email: String,
password: String,
content: List(#(String, surreal_ql.SurrealQL)),
) -> Result(String, suweal.SurrealError)
Access an existing account inside the SurrealDB database server. https://surrealdb.com/docs/reference/rest-api/http-protocol#signin
pub fn signin_request(
connection: suweal.Connection,
body: AuthenticationBody,
) -> Result(request.Request(String), suweal.SurrealError)
Access an existing account inside the SurrealDB database server. https://surrealdb.com/docs/reference/rest-api/http-protocol#signin
pub fn signup(
connection: suweal.Connection,
table: String,
email: String,
password: String,
content: List(#(String, surreal_ql.SurrealQL)),
) -> Result(String, suweal.SurrealError)
Create an account inside the SurrealDB database server. https://surrealdb.com/docs/reference/rest-api/http-protocol#signup
pub fn signup_request(
connection: suweal.Connection,
body: AuthenticationBody,
) -> Result(request.Request(String), suweal.SurrealError)
Create an account inside the SurrealDB database server. https://surrealdb.com/docs/reference/rest-api/http-protocol#signup
pub fn status(connection: suweal.Connection) -> Result(Nil, Nil)
The status endpoint returns a simple response indicating the status of the SurrealDB server. https://surrealdb.com/docs/reference/rest-api/http-protocol#status
pub fn status_request(
connection: suweal.Connection,
) -> Result(request.Request(String), Nil)
The status endpoint returns a simple response indicating the status of the SurrealDB server. https://surrealdb.com/docs/reference/rest-api/http-protocol#status
pub fn version(
connection: suweal.Connection,
) -> Result(String, suweal.SurrealError)
The version endpoint returns the current version of the SurrealDB server. https://surrealdb.com/docs/reference/rest-api/http-protocol#version
pub fn version_request(
connection: suweal.Connection,
) -> Result(request.Request(String), suweal.SurrealError)
The version endpoint returns the current version of the SurrealDB server. https://surrealdb.com/docs/reference/rest-api/http-protocol#version