π 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 yourCargo.toml:
π Basic Usage
ποΈ CRUD Operations
Create Data
Read Data
Modify a Field
Delete Data
π§© Advanced Queries with field_array π
You can perform operations on multiple objects that meet certain conditions using the field_array field:
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:πΈοΈ Relations and Graphs
You can create relationships between objects (vertices):π Encryption and Security
Easily encrypt and decrypt data:π¦ Array Manipulation Methods
Below are the available methods to manipulate arrays in the Satori database using the Rust client:πΉ push
Adds a value to an existing array in an object.πΉ pop
Removes the last element from an array in an object.πΉ splice
Modifies an array in an object (for example, to cut or replace elements).πΉ remove
Removes a specific value from an array in an object.πΉ ann
Perform an Aproximate Nearest Neighbors searchπΉ query
Make a query to the db in natural languageπΉ ask
Ask questions about your dataNotes on AI
In the functions wherebackend must be specified this parameter must passed with the following format: openai:model-name or ollama:model-name. If youβre using OpenAI as your backend you must specify the OPENAI_API_KEY env variable. If backend isnβt specified openai:gpt-4o-mini will be used as default.
The trained embedding model will be at the root of your db in a folder called satori_semantic_model.
You can train your embedding model manually whenever you want to but Satori will automatically fine-tune your model with any new updates and use this updated model for all emebedding operations.
π¦ Schema Struct (Data Model) β Rust
You can use theSchema struct to model your data in an object-oriented way:
-
set,delete,encrypt,decrypt,set_vertex,get_vertex,delete_vertex,dfs -
Array methods:
push,pop,splice,remove
π Complete Example
π§ 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.