π Satori Rust SDK
This library allows you to easily and efficiently interact with the Satori database via WebSockets, supporting CRUD operations, real-time notifications, advanced queries, and graph-like relations.
β¨ Main Features
- Ultra-fast CRUD operations β‘
- Advanced queries using
field_arrayπ - Real-time notifications π’
- Graph-like relations (vertices and references) πΈοΈ
- Data encryption and decryption π
π Installation
Add the following to your Cargo.toml:
[]
= "0.1.0"
= { = "1.36", = ["full"] }
π Basic Usage
use Satori;
async
ποΈ CRUD Operations
Create Data
client.set.await?;
Read Data
let user = client.get.await?;
Modify a Field
client.put.await?;
Delete Data
client.delete.await?;
π§© Advanced Queries with field_array π
You can perform operations on multiple objects that meet certain conditions using the field_array field:
let results = client.get.await?;
field_arrayis an array of conditions{ "field": ..., "value": ... }.- You can combine it with
"one": trueto get only the first matching result.
π Real-time Notifications
Receive automatic updates when an object changes:
client.set_notify.await?;
To stop receiving notifications:
client.unnotify.await?;
πΈοΈ Relations and Graphs
You can create relationships between objects (vertices):
client.set_vertex.await?;
And traverse the graph with DFS:
client.dfs.await?;
Get all neighbors of an object:
client.get_vertex.await?;
Remove a specific neighbor:
client.delete_vertex.await?;
π Encryption and Security
Easily encrypt and decrypt data:
client.encrypt.await?;
client.decrypt.await?;
π¦ Array and Reference Manipulation Methods
Below are the available methods to manipulate arrays and references in the Satori database using the Rust client:
πΉ push
Adds a value to an existing array in an object.
client.push.await?;
πΉ pop
Removes the last element from an array in an object.
client.pop.await?;
πΉ splice
Modifies an array in an object (for example, to cut or replace elements).
client.splice.await?;
πΉ remove
Removes a specific value from an array in an object.
client.remove.await?;
πΉ setRef
Sets a reference to another object.
client.set_ref.await?;
πΉ getRefs
Retrieves all references for an object.
let refs = client.get_refs.await?;
πΉ deleteRef
Deletes a specific reference from an object.
client.delete_ref.await?;
π Complete Example
use Satori;
async
π§ Key Concepts
- key: Unique identifier of the object.
- type: Object type (e.g., 'user').
- field_array: Advanced filters for bulk operations.
- notifications: Subscription to real-time changes.
- vertices: Graph-like relationships between objects.
π¬ Questions or Suggestions?
Feel free to open an issue or contribute! With β€οΈ from the Satori team.