Rust

Databases, tables, columns, indexes and rows.

Contents

2 submodules, and what the module defines itself.

use utopia_migration::resources::database::Database;
Rust
pub struct Database

A database.

use utopia_migration::resources::database::Field;
Rust
pub struct Field

A column (or attribute) of a table.

use utopia_migration::resources::database::FieldSpec;
Rust
pub struct FieldSpec

Arguments common to every column constructor.

use utopia_migration::resources::database::Index;
Rust
pub struct Index

An index of a table.

use utopia_migration::resources::database::Row;
Rust
pub struct Row

A row of a table (or a document of a collection).

use utopia_migration::resources::database::Table;
Rust
pub struct Table

A table, or a collection of a DocumentsDB or VectorsDB database.

use utopia_migration::resources::database::DatabaseFlavor;
Rust
pub enum DatabaseFlavor

Which database class a database resource is.

use utopia_migration::resources::database::FieldClass;
Rust
pub enum FieldClass

The class of a column (or an attribute derived from one).

use utopia_migration::resources::database::resolve;
Rust
pub fn resolve(definition: &Array) -> (String, String, i64)

A column definition resolved to the type, format and size Appwrite stores: a format shorthand becomes a string of that format, a missing size comes from the type or the format.

Rust
pub const LENGTH_KEY: i64 = 255

Undocumented.

database::column

Own page
Rust
pub const BIG_INT: &str = "bigint"

A big integer.

Rust
pub const BOOLEAN: &str = "boolean"

A boolean.

Rust
pub const DATETIME: &str = "datetime"

A datetime.

Rust
pub const DEFAULT_VARCHAR_SIZE: i64 = 255

The size of a varchar given none (Column::DEFAULT_VARCHAR_SIZE).

Rust
pub const EMAIL: &str = "email"

An email string.

Rust
pub const ENUM: &str = "enum"

An enum string.

Rust
pub const FLOAT: &str = "double"

A float.

Rust
pub const FORMAT_SIZES: &[(&str, i64)] = &[(EMAIL, 254), (ENUM, super::LENGTH_KEY), (IP, 39), (URL, 2000)]

Format shorthands and their sizes (Column::FORMAT_SIZES).

Rust
pub const INTEGER: &str = "integer"

An integer.

Rust
pub const IP: &str = "ip"

An IP string.

Rust
pub const LINE: &str = "linestring"

A line.

Rust
pub const LONGTEXT: &str = "longtext"

A LONGTEXT string.

Rust
pub const MEDIUMTEXT: &str = "mediumtext"

A MEDIUMTEXT string.

Rust
pub const OBJECT: &str = "object"

An object.

Rust
pub const POINT: &str = "point"

A point.

Rust
pub const POLYGON: &str = "polygon"

A polygon.

Rust
pub const RELATIONSHIP: &str = "relationship"

A relationship.

Rust
pub const SIZES: &[(&str, i64)] = &[(TEXT, 65535), (MEDIUMTEXT, 16_777_215), (LONGTEXT, 2_147_483_647)]

Sizes fixed by the type (Column::SIZES).

Rust
pub const STRING: &str = "string"

A string.

Rust
pub const TEXT: &str = "text"

A TEXT string.

Rust
pub const URL: &str = "url"

A URL string.

Rust
pub const VARCHAR: &str = "varchar"

A VARCHAR string.

Rust
pub const VECTOR: &str = "vector"

A vector.

database::columns

Own page

Builders of each column class with its constructor's defaults.

use utopia_migration::resources::database::columns::boolean;
Rust
pub fn boolean(key: &str, table: ResourceRef, required: bool, default: Option<bool>, array: bool) -> Field

A Boolean column.

use utopia_migration::resources::database::columns::datetime;
Rust
pub fn datetime(key: &str, table: ResourceRef, required: bool, default: Option<String>, array: bool) -> Field

A DateTime column (with the datetime filter).

use utopia_migration::resources::database::columns::decimal;
Rust
pub fn decimal(key: &str, table: ResourceRef, required: bool, default: Option<f64>, array: bool, min: Option<f64>, max: Option<f64>, signed: bool) -> Field

Undocumented.

use utopia_migration::resources::database::columns::default_size;
Rust
pub fn default_size(class: FieldClass) -> i64

The default size of a string class (Text: LENGTH_KEY, Email: 254, ...).

use utopia_migration::resources::database::columns::enumeration;
Rust
pub fn enumeration(key: &str, table: ResourceRef, elements: Array, required: bool, default: Option<String>, array: bool, size: i64) -> Field

An Enum column.

use utopia_migration::resources::database::columns::from_array;
Rust
pub fn from_array(class: FieldClass, array: &Array) -> Result<ResourceRef>

Of column class class. Email, IP and URL inherit Text::fromArray(), which builds a Text (it calls new self), so they return Text columns.

use utopia_migration::resources::database::columns::integer;
Rust
pub fn integer(big: bool, key: &str, table: ResourceRef, required: bool, default: Option<i64>, array: bool, min: Option<i64>, max: Option<i64>, signed: bool) -> Field

An Integer (big: false) or BigInt column.

use utopia_migration::resources::database::columns::relationship;
Rust
pub fn relationship(key: &str, table: ResourceRef, related_table: &str, relation_type: &str, two_way: bool, two_way_key: Option<String>, on_delete: &str, side: &str) -> Field

A Relationship column.

use utopia_migration::resources::database::columns::structured;
Rust
pub fn structured(class: FieldClass, key: &str, table: ResourceRef, required: bool, default: Option<Array>) -> Field

A Point, Line, Polygon or ObjectType column.

use utopia_migration::resources::database::columns::text;
Rust
pub fn text(class: FieldClass, key: &str, table: ResourceRef, required: bool, default: Option<String>, array: bool, size: i64, format: &str) -> Field

A string column of class class (Text, Email, IP, URL, RegularText, MediumText, LongText, Varchar, Enum without elements).

use utopia_migration::resources::database::columns::vector;
Rust
pub fn vector(key: &str, table: ResourceRef, required: bool, size: i64, default: Option<Array>) -> Field

A Vector column.