Database

Struct Database 

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

Implementations§

Source§

impl Database

Source

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

Source

pub fn list_collections( &self, search: Option<&str>, limit: Option<i64>, offset: Option<i64>, cursor: Option<&str>, cursor_direction: Option<&str>, order_type: Option<&str>, ) -> Result<CollectionList, AppwriteException>

Get a list of all the user collections. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project’s collections. Learn more about different API modes.

Source

pub fn create_collection( &self, collection_id: &str, name: &str, permission: &str, read: &[&str], write: &[&str], ) -> Result<Collection, AppwriteException>

Create a new Collection.

Source

pub fn get_collection( &self, collection_id: &str, ) -> Result<Collection, AppwriteException>

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

Source

pub fn update_collection( &self, collection_id: &str, name: &str, permission: &str, read: Option<&[&str]>, write: Option<&[&str]>, enabled: Option<bool>, ) -> Result<Collection, AppwriteException>

Update a collection by its unique ID.

Source

pub fn delete_collection( &self, collection_id: &str, ) -> Result<Value, AppwriteException>

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

Source

pub fn list_attributes( &self, collection_id: &str, ) -> Result<AttributeList, AppwriteException>

Source

pub fn create_boolean_attribute( &self, collection_id: &str, key: &str, required: bool, default: Option<bool>, array: Option<bool>, ) -> Result<AttributeBoolean, AppwriteException>

Create a boolean attribute.

Source

pub fn create_email_attribute( &self, collection_id: &str, key: &str, required: bool, default: Option<&str>, array: Option<bool>, ) -> Result<AttributeEmail, AppwriteException>

Create an email attribute.

Source

pub fn create_enum_attribute( &self, collection_id: &str, key: &str, elements: &[&str], required: bool, default: Option<&str>, array: Option<bool>, ) -> Result<AttributeEnum, AppwriteException>

Source

pub fn create_float_attribute( &self, collection_id: &str, key: &str, required: bool, min: Option<f64>, max: Option<f64>, default: Option<f64>, array: Option<bool>, ) -> Result<AttributeFloat, AppwriteException>

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

Source

pub fn create_integer_attribute( &self, collection_id: &str, key: &str, required: bool, min: Option<i64>, max: Option<i64>, default: Option<i64>, array: Option<bool>, ) -> Result<AttributeInteger, AppwriteException>

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

Source

pub fn create_ip_attribute( &self, collection_id: &str, key: &str, required: bool, default: Option<&str>, array: Option<bool>, ) -> Result<AttributeIp, AppwriteException>

Create IP address attribute.

Source

pub fn create_string_attribute( &self, collection_id: &str, key: &str, size: i64, required: bool, default: Option<&str>, array: Option<bool>, ) -> Result<AttributeString, AppwriteException>

Create a string attribute.

Source

pub fn create_url_attribute( &self, collection_id: &str, key: &str, required: bool, default: Option<&str>, array: Option<bool>, ) -> Result<AttributeUrl, AppwriteException>

Create a URL attribute.

Source

pub fn get_attribute( &self, collection_id: &str, key: &str, ) -> Result<Value, AppwriteException>

Source

pub fn delete_attribute( &self, collection_id: &str, key: &str, ) -> Result<Value, AppwriteException>

Source

pub fn list_documents( &self, collection_id: &str, queries: Option<&[&str]>, limit: Option<i64>, offset: Option<i64>, cursor: Option<&str>, cursor_direction: Option<&str>, order_attributes: Option<&[&str]>, order_types: Option<&[&str]>, ) -> Result<DocumentList, AppwriteException>

Get a list of all the user documents. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project’s documents. Learn more about different API modes.

Source

pub fn create_document( &self, collection_id: &str, document_id: &str, data: Option<HashMap<String, ParamType>>, read: Option<&[&str]>, write: Option<&[&str]>, ) -> Result<Document, AppwriteException>

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

Source

pub fn get_document( &self, collection_id: &str, document_id: &str, ) -> Result<Document, AppwriteException>

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

Source

pub fn update_document( &self, collection_id: &str, document_id: &str, data: Option<HashMap<String, ParamType>>, read: Option<&[&str]>, write: Option<&[&str]>, ) -> Result<Document, AppwriteException>

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

Source

pub fn delete_document( &self, collection_id: &str, document_id: &str, ) -> Result<Value, AppwriteException>

Delete a document by its unique ID. This endpoint deletes only the parent documents, its attributes and relations to other documents. Child documents will not be deleted.

Source

pub fn list_document_logs( &self, collection_id: &str, document_id: &str, limit: Option<i64>, offset: Option<i64>, ) -> Result<LogList, AppwriteException>

Get the document activity logs list by its unique ID.

Source

pub fn list_indexes( &self, collection_id: &str, ) -> Result<IndexList, AppwriteException>

Source

pub fn create_index( &self, collection_id: &str, key: &str, xtype: &str, attributes: &[&str], orders: Option<&[&str]>, ) -> Result<Index, AppwriteException>

Source

pub fn get_index( &self, collection_id: &str, key: &str, ) -> Result<Index, AppwriteException>

Source

pub fn delete_index( &self, collection_id: &str, key: &str, ) -> Result<Value, AppwriteException>

Source

pub fn list_collection_logs( &self, collection_id: &str, limit: Option<i64>, offset: Option<i64>, ) -> Result<LogList, AppwriteException>

Get the collection activity logs list by its unique ID.

Source

pub fn get_usage( &self, range: Option<&str>, ) -> Result<UsageDatabase, AppwriteException>

Source

pub fn get_collection_usage( &self, collection_id: &str, range: Option<&str>, ) -> Result<UsageCollection, AppwriteException>

Trait Implementations§

Source§

impl Clone for Database

Source§

fn clone(&self) -> Database

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

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> 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
Source§

impl<T> ErasedDestructor for T
where T: 'static,