Rust

sources

Module

The sources resources are exported from.

Contents

10 submodules.

sources::appwrite

Own page

The Appwrite source: its readers, and the builders that turn what they read into resources.

use utopia_migration::sources::appwrite::get_attribute;
Rust
pub fn get_attribute(collection: &ResourceRef, definition: &Array) -> Result<ResourceRef>

The attribute form of get_column for a collection.

use utopia_migration::sources::appwrite::get_column;
Rust
pub fn get_column(table: &ResourceRef, definition: &Array) -> Result<ResourceRef>

A column resource of table from a column definition (as the API or the attributes collection report it). A format given as the type (email, url, ip, enum) and a missing size are resolved the way the server resolves them (resolve).

use utopia_migration::sources::appwrite::get_database;
Rust
pub fn get_database(database_type: &str, database: &Array) -> Result<ResourceRef>

A database resource of database_type (DocumentsDB, VectorsDB, or Database).

use utopia_migration::sources::appwrite::get_entity;
Rust
pub fn get_entity(database_type: &str, entity: &Array) -> Result<ResourceRef>

A table (Database) or collection (DocumentsDB, VectorsDB) resource.

use utopia_migration::sources::appwrite::get_record;
Rust
pub fn get_record(database_type: &str, record: &Array) -> Result<ResourceRef>

A row (Database) or document (DocumentsDB, VectorsDB) resource.

sources::appwrite::api_reader

Own page

Reading databases through the Appwrite API.

use utopia_migration::sources::appwrite::api_reader::ApiReader;
Rust
pub struct ApiReader

Reads databases through the API's TablesDB service; rows and the rest as the models' arrays.

sources::appwrite::reader

Own page

How the Appwrite source reads databases: through the API, or straight from the project's database.

use utopia_migration::sources::appwrite::reader::DatabaseReader;
Rust
pub struct DatabaseReader

Reads straight from the project's database (_databases, _attributes, _indexes and the per-database collections).

Also implements Debug.
use utopia_migration::sources::appwrite::reader::Cursor;
Rust
pub enum Cursor

Where a cursor points: a resource, or an id.

use utopia_migration::sources::appwrite::reader::ReaderQuery;
Rust
pub enum ReaderQuery

A query of a reader: an API query string, or a database query.

use utopia_migration::sources::appwrite::reader::Reader;
Rust
pub trait Reader: Send + Sync

Lists databases, tables, columns, indexes and rows for the Appwrite source, and builds the queries it pages them with.

use utopia_migration::sources::appwrite::reader::plain;
Rust
pub fn plain(doc: &Document) -> Array

A document as a plain array (getArrayCopy()).

Rust
pub type DatabaseResolver = Arc<dyn Fn(&Document) -> Db + Send + Sync>

Resolves the database a database document's data lives in.

sources::appwrite::source

Own page

An Appwrite project as the source.

use utopia_migration::sources::appwrite::source::Appwrite;
Rust
pub struct Appwrite

An Appwrite project as a source.

Also implements Debug.
Rust
pub const SOURCE_API: &str = "api"

Read databases through the API.

Rust
pub const SOURCE_DATABASE: &str = "database"

Read databases straight from the project's database.

sources::csv

Own page

Rows of one table from a CSV file, typed by the table's columns.

use utopia_migration::sources::csv::Csv;
Rust
pub struct Csv

Rows of one table from a CSV file on a storage device. The header names the columns; values are typed by the table's columns, read from the project's database. The file is deleted after the export.

Also implements Debug.
use utopia_migration::sources::csv::detect_delimiter;
Rust
pub fn detect_delimiter<R: Read>(stream: R) -> io::Result<u8>

The delimiter of CSV data: of ,, ;, tab and |, the one that splits the first five non-blank lines into the most consistent number of fields with the most fields longer than one character (, when none splits anything).

sources::firebase

Own page

A Firebase project as the source: users from Identity Toolkit, documents from Firestore, files from Cloud Storage.

use utopia_migration::sources::firebase::Firebase;
Rust
pub struct Firebase

A Firebase project, read with a service account.

Also implements Debug.
use utopia_migration::sources::firebase::sanitize_bucket_id;
Rust
pub fn sanitize_bucket_id(id: &str) -> String

A bucket id Appwrite accepts: the first label of a domain-like id, at most 36 characters of [a-zA-Z0-9._-], not starting with ., _ or -.

sources::json

Own page

Rows from a JSON file: an array of objects, streamed.

use utopia_migration::sources::json::Json;
Rust
pub struct Json

Rows of one table from a JSON file on a storage device: each item of the top-level array is a row ($id and $permissions are taken out of its attributes). The file is deleted after the export.

Also implements Debug.

sources::nhost

Own page

An NHost project as the source: users, the public schema's tables and rows, and storage files, read from its PostgreSQL database; file contents through its storage API.

use utopia_migration::sources::nhost::NHost;
Rust
pub struct NHost

An NHost project.

Also implements Debug.
use utopia_migration::sources::nhost::convert_index;
Rust
pub fn convert_index(definition: &str, table: &ResourceRef) -> Option<ResourceRef>

The index of a CREATE <TYPE> INDEX <name> ON <schema>.<table> USING btree (<column>) definition (only those match: a plain CREATE INDEX, several columns or another method do not).

use utopia_migration::sources::nhost::status_code_from_error;
Rust
pub fn status_code_from_error(e: &Error) -> i64

The status code of an error: its SQLSTATE's, or its positive code.

use utopia_migration::sources::nhost::status_code_from_sql_state;
Rust
pub fn status_code_from_sql_state(sql_state: Option<&str>) -> i64

The status code of a PostgreSQL SQLSTATE.

sources::pg

Own page
use utopia_migration::sources::pg::Pg;
Rust
pub struct Pg

A connection.

Also implements Debug.
use utopia_migration::sources::pg::Param;
Rust
pub enum Param

A parameter of a query.

sources::supabase

Own page

A Supabase project as the source: NHost's database export, with Supabase's users, buckets and objects; object contents through its storage API.

use utopia_migration::sources::supabase::Supabase;
Rust
pub struct Supabase

A Supabase project.

Also implements Debug.