Skip to main content

TablesDB

Struct TablesDB 

Source
pub struct TablesDB { /* private fields */ }

Implementations§

Source§

impl TablesDB

Source

pub fn new(client: &Client) -> Self

Source

pub fn client(&self) -> &Client

Source

pub async fn list( &self, queries: Option<Vec<String>>, search: Option<&str>, total: Option<bool>, ) -> Result<DatabaseList>

Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results.

Source

pub async fn create( &self, database_id: impl Into<String>, name: impl Into<String>, enabled: Option<bool>, ) -> Result<Database>

Create a new Database.

Source

pub async fn list_transactions( &self, queries: Option<Vec<String>>, ) -> Result<TransactionList>

List transactions across all databases.

Source

pub async fn create_transaction(&self, ttl: Option<i64>) -> Result<Transaction>

Create a new transaction.

Source

pub async fn get_transaction( &self, transaction_id: impl Into<String>, ) -> Result<Transaction>

Get a transaction by its unique ID.

Source

pub async fn update_transaction( &self, transaction_id: impl Into<String>, commit: Option<bool>, rollback: Option<bool>, ) -> Result<Transaction>

Update a transaction, to either commit or roll back its operations.

Source

pub async fn delete_transaction( &self, transaction_id: impl Into<String>, ) -> Result<()>

Delete a transaction by its unique ID.

Source

pub async fn create_operations( &self, transaction_id: impl Into<String>, operations: Option<Vec<Value>>, ) -> Result<Transaction>

Create multiple operations in a single transaction.

Source

pub async fn get(&self, database_id: impl Into<String>) -> Result<Database>

Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata.

Source

pub async fn update( &self, database_id: impl Into<String>, name: Option<&str>, enabled: Option<bool>, ) -> Result<Database>

Update a database by its unique ID.

Source

pub async fn delete(&self, database_id: impl Into<String>) -> Result<()>

Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database.

Source

pub async fn list_tables( &self, database_id: impl Into<String>, queries: Option<Vec<String>>, search: Option<&str>, total: Option<bool>, ) -> Result<TableList>

Get a list of all tables that belong to the provided databaseId. You can use the search parameter to filter your results.

Source

pub async fn create_table( &self, database_id: impl Into<String>, table_id: impl Into<String>, name: impl Into<String>, permissions: Option<Vec<String>>, row_security: Option<bool>, enabled: Option<bool>, columns: Option<Vec<Value>>, indexes: Option<Vec<Value>>, ) -> Result<Table>

Create a new Table. Before using this route, you should create a new database resource using either a server integration API or directly from your database console.

Source

pub async fn get_table( &self, database_id: impl Into<String>, table_id: impl Into<String>, ) -> Result<Table>

Get a table by its unique ID. This endpoint response returns a JSON object with the table metadata.

Source

pub async fn update_table( &self, database_id: impl Into<String>, table_id: impl Into<String>, name: Option<&str>, permissions: Option<Vec<String>>, row_security: Option<bool>, enabled: Option<bool>, purge: Option<bool>, ) -> Result<Table>

Update a table by its unique ID.

Source

pub async fn delete_table( &self, database_id: impl Into<String>, table_id: impl Into<String>, ) -> Result<()>

Delete a table by its unique ID. Only users with write permissions have access to delete this resource.

Source

pub async fn list_columns( &self, database_id: impl Into<String>, table_id: impl Into<String>, queries: Option<Vec<String>>, total: Option<bool>, ) -> Result<ColumnList>

List columns in the table.

Source

pub async fn create_boolean_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<bool>, array: Option<bool>, ) -> Result<ColumnBoolean>

Create a boolean column.

Source

pub async fn update_boolean_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<bool>, new_key: Option<&str>, ) -> Result<ColumnBoolean>

Update a boolean column. Changing the default value will not update already existing rows.

Source

pub async fn create_datetime_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, array: Option<bool>, ) -> Result<ColumnDatetime>

Create a date time column according to the ISO 8601 standard.

Source

pub async fn update_datetime_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, new_key: Option<&str>, ) -> Result<ColumnDatetime>

Update a date time column. Changing the default value will not update already existing rows.

Source

pub async fn create_email_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, array: Option<bool>, ) -> Result<ColumnEmail>

Create an email column.

Source

pub async fn update_email_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, new_key: Option<&str>, ) -> Result<ColumnEmail>

Update an email column. Changing the default value will not update already existing rows.

Source

pub async fn create_enum_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, elements: impl IntoIterator<Item = impl Into<String>>, required: bool, default: Option<&str>, array: Option<bool>, ) -> Result<ColumnEnum>

Create an enumeration column. The elements param acts as a white-list of accepted values for this column.

Source

pub async fn update_enum_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, elements: impl IntoIterator<Item = impl Into<String>>, required: bool, default: Option<&str>, new_key: Option<&str>, ) -> Result<ColumnEnum>

Update an enum column. Changing the default value will not update already existing rows.

Source

pub async fn create_float_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, min: Option<f64>, max: Option<f64>, default: Option<f64>, array: Option<bool>, ) -> Result<ColumnFloat>

Create a float column. Optionally, minimum and maximum values can be provided.

Source

pub async fn update_float_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<f64>, min: Option<f64>, max: Option<f64>, new_key: Option<&str>, ) -> Result<ColumnFloat>

Update a float column. Changing the default value will not update already existing rows.

Source

pub async fn create_integer_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, min: Option<i64>, max: Option<i64>, default: Option<i64>, array: Option<bool>, ) -> Result<ColumnInteger>

Create an integer column. Optionally, minimum and maximum values can be provided.

Source

pub async fn update_integer_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<i64>, min: Option<i64>, max: Option<i64>, new_key: Option<&str>, ) -> Result<ColumnInteger>

Update an integer column. Changing the default value will not update already existing rows.

Source

pub async fn create_ip_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, array: Option<bool>, ) -> Result<ColumnIp>

Create IP address column.

Source

pub async fn update_ip_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, new_key: Option<&str>, ) -> Result<ColumnIp>

Update an ip column. Changing the default value will not update already existing rows.

Source

pub async fn create_line_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<Vec<String>>, ) -> Result<ColumnLine>

Create a geometric line column.

Source

pub async fn update_line_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<Vec<String>>, new_key: Option<&str>, ) -> Result<ColumnLine>

Update a line column. Changing the default value will not update already existing rows.

Source

pub async fn create_longtext_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, array: Option<bool>, encrypt: Option<bool>, ) -> Result<ColumnLongtext>

Create a longtext column.

Source

pub async fn update_longtext_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, new_key: Option<&str>, ) -> Result<ColumnLongtext>

Update a longtext column. Changing the default value will not update already existing rows.

Source

pub async fn create_mediumtext_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, array: Option<bool>, encrypt: Option<bool>, ) -> Result<ColumnMediumtext>

Create a mediumtext column.

Source

pub async fn update_mediumtext_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, new_key: Option<&str>, ) -> Result<ColumnMediumtext>

Update a mediumtext column. Changing the default value will not update already existing rows.

Source

pub async fn create_point_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<Vec<String>>, ) -> Result<ColumnPoint>

Create a geometric point column.

Source

pub async fn update_point_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<Vec<String>>, new_key: Option<&str>, ) -> Result<ColumnPoint>

Update a point column. Changing the default value will not update already existing rows.

Source

pub async fn create_polygon_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<Vec<String>>, ) -> Result<ColumnPolygon>

Create a geometric polygon column.

Source

pub async fn update_polygon_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<Vec<String>>, new_key: Option<&str>, ) -> Result<ColumnPolygon>

Update a polygon column. Changing the default value will not update already existing rows.

Source

pub async fn create_relationship_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, related_table_id: impl Into<String>, type: RelationshipType, two_way: Option<bool>, key: Option<&str>, two_way_key: Option<&str>, on_delete: Option<RelationMutate>, ) -> Result<ColumnRelationship>

Create relationship column. Learn more about relationship columns.

Source

pub async fn create_string_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, size: i64, required: bool, default: Option<&str>, array: Option<bool>, encrypt: Option<bool>, ) -> Result<ColumnString>

Create a string column.

Source

pub async fn update_string_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, size: Option<i64>, new_key: Option<&str>, ) -> Result<ColumnString>

Update a string column. Changing the default value will not update already existing rows.

Source

pub async fn create_text_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, array: Option<bool>, encrypt: Option<bool>, ) -> Result<ColumnText>

Create a text column.

Source

pub async fn update_text_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, new_key: Option<&str>, ) -> Result<ColumnText>

Update a text column. Changing the default value will not update already existing rows.

Source

pub async fn create_url_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, array: Option<bool>, ) -> Result<ColumnUrl>

Create a URL column.

Source

pub async fn update_url_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, new_key: Option<&str>, ) -> Result<ColumnUrl>

Update an url column. Changing the default value will not update already existing rows.

Source

pub async fn create_varchar_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, size: i64, required: bool, default: Option<&str>, array: Option<bool>, encrypt: Option<bool>, ) -> Result<ColumnVarchar>

Create a varchar column.

Source

pub async fn update_varchar_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, required: bool, default: Option<&str>, size: Option<i64>, new_key: Option<&str>, ) -> Result<ColumnVarchar>

Update a varchar column. Changing the default value will not update already existing rows.

Source

pub async fn get_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, ) -> Result<Value>

Get column by ID.

Source

pub async fn delete_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, ) -> Result<()>

Deletes a column.

Source

pub async fn update_relationship_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, on_delete: Option<RelationMutate>, new_key: Option<&str>, ) -> Result<ColumnRelationship>

Update relationship column. Learn more about relationship columns.

Source

pub async fn list_indexes( &self, database_id: impl Into<String>, table_id: impl Into<String>, queries: Option<Vec<String>>, total: Option<bool>, ) -> Result<ColumnIndexList>

List indexes on the table.

Source

pub async fn create_index( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, type: TablesDBIndexType, columns: impl IntoIterator<Item = impl Into<String>>, orders: Option<Vec<OrderBy>>, lengths: Option<Vec<i64>>, ) -> Result<ColumnIndex>

Creates an index on the columns listed. Your index should include all the columns you will query in a single request. Type can be key, fulltext, or unique.

Source

pub async fn get_index( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, ) -> Result<ColumnIndex>

Get index by ID.

Source

pub async fn delete_index( &self, database_id: impl Into<String>, table_id: impl Into<String>, key: impl Into<String>, ) -> Result<()>

Delete an index.

Source

pub async fn list_rows( &self, database_id: impl Into<String>, table_id: impl Into<String>, queries: Option<Vec<String>>, transaction_id: Option<&str>, total: Option<bool>, ttl: Option<i64>, ) -> Result<RowList>

Get a list of all the user’s rows in a given table. You can use the query params to filter your results.

Source

pub async fn create_row( &self, database_id: impl Into<String>, table_id: impl Into<String>, row_id: impl Into<String>, data: Value, permissions: Option<Vec<String>>, transaction_id: Option<&str>, ) -> Result<Row>

Create a new Row. Before using this route, you should create a new table resource using either a server integration API or directly from your database console.

Source

pub async fn create_rows( &self, database_id: impl Into<String>, table_id: impl Into<String>, rows: Vec<Value>, transaction_id: Option<&str>, ) -> Result<RowList>

Create new Rows. Before using this route, you should create a new table resource using either a server integration API or directly from your database console.

Source

pub async fn upsert_rows( &self, database_id: impl Into<String>, table_id: impl Into<String>, rows: Vec<Value>, transaction_id: Option<&str>, ) -> Result<RowList>

Create or update Rows. Before using this route, you should create a new table resource using either a server integration API or directly from your database console.

Source

pub async fn update_rows( &self, database_id: impl Into<String>, table_id: impl Into<String>, data: Option<Value>, queries: Option<Vec<String>>, transaction_id: Option<&str>, ) -> Result<RowList>

Update all rows that match your queries, if no queries are submitted then all rows are updated. You can pass only specific fields to be updated.

Source

pub async fn delete_rows( &self, database_id: impl Into<String>, table_id: impl Into<String>, queries: Option<Vec<String>>, transaction_id: Option<&str>, ) -> Result<RowList>

Bulk delete rows using queries, if no queries are passed then all rows are deleted.

Source

pub async fn get_row( &self, database_id: impl Into<String>, table_id: impl Into<String>, row_id: impl Into<String>, queries: Option<Vec<String>>, transaction_id: Option<&str>, ) -> Result<Row>

Get a row by its unique ID. This endpoint response returns a JSON object with the row data.

Source

pub async fn upsert_row( &self, database_id: impl Into<String>, table_id: impl Into<String>, row_id: impl Into<String>, data: Option<Value>, permissions: Option<Vec<String>>, transaction_id: Option<&str>, ) -> Result<Row>

Create or update a Row. Before using this route, you should create a new table resource using either a server integration API or directly from your database console.

Source

pub async fn update_row( &self, database_id: impl Into<String>, table_id: impl Into<String>, row_id: impl Into<String>, data: Option<Value>, permissions: Option<Vec<String>>, transaction_id: Option<&str>, ) -> Result<Row>

Update a row by its unique ID. Using the patch method you can pass only specific fields that will get updated.

Source

pub async fn delete_row( &self, database_id: impl Into<String>, table_id: impl Into<String>, row_id: impl Into<String>, transaction_id: Option<&str>, ) -> Result<()>

Delete a row by its unique ID.

Source

pub async fn decrement_row_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, row_id: impl Into<String>, column: impl Into<String>, value: Option<f64>, min: Option<f64>, transaction_id: Option<&str>, ) -> Result<Row>

Decrement a specific column of a row by a given value.

Source

pub async fn increment_row_column( &self, database_id: impl Into<String>, table_id: impl Into<String>, row_id: impl Into<String>, column: impl Into<String>, value: Option<f64>, max: Option<f64>, transaction_id: Option<&str>, ) -> Result<Row>

Increment a specific column of a row by a given value.

Trait Implementations§

Source§

impl Clone for TablesDB

Source§

fn clone(&self) -> TablesDB

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TablesDB

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Service for TablesDB

Source§

fn client(&self) -> &Client

Get a reference to the client

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more