Skip to main content

Crate utopia_database

Crate utopia_database 

Source
Expand description

A document database: collections with typed attributes and indexes, documents with permissions, queries, relationships, tenancy and caching, over pluggable storage adapters.

The crate reads and writes the same tables, rows and metadata as utopia-php/database, so PHP and Rust services share one dataset.

§Port status

Only the modules without I/O are here so far: identifiers, roles, permissions, dates and the errors they fail with. The rest of the crate (the model, the adapters, the validators and the Error marks they set) comes from appwrite/appwrite#14308.

§PHP classes and their Rust items

PHPRust
Utopia\Database\Idid
Utopia\Database\RoleRole
Utopia\Database\Permission, PermissionTypePermission, PermissionType
Utopia\Database\DateTimedatetime
Utopia\Database\Exception and Exception\*Error, Kind

Re-exports§

pub use error::Error;
pub use error::Kind;
pub use error::Result;
pub use permission::Permission;
pub use permission::PermissionType;
pub use role::Role;

Modules§

datetime
Dates as the database stores them: Y-m-d H:i:s.v in the default timezone (FORMAT_DB), and as the API shows them, with the offset (FORMAT_TZ).
error
The errors database operations fail with.
id
Document identifiers: unique generates one, custom takes one given.
permission
Permission: an action granted to a Role, written action("role") (read("any"), update("team:123/owner")).
role
Role: who a permission is granted to (any, users, user:<id>, team:<id>/<dimension>, …).