[][src]Struct azure_functions::bindings::Table

pub struct Table(_);

Represents an Azure Storage table input or output binding.

The following binding attributes are supported:

NameDescription
nameThe name of the parameter being bound.
table_nameThe name of the table.
partition_keyThe partition key of the table entity to read or write.
row_keyThe row key of the table entity to read or write.
filterThe maximum number of entities to read (optional; input only).
takeThe OData filter expression of entities to read (optional; input only).
connectionThe name of an app setting that contains the Storage connection string to use for this binding. Defaults to AzureWebJobsStorage.

Examples

Read a table storage row based on a key posted to the example queue:

use azure_functions::bindings::{QueueTrigger, Table};
use azure_functions::func;
use log::info;

#[func]
#[binding(name = "trigger", queue_name = "example")]
#[binding(name = "table", table_name = "MyTable", partition_key = "MyPartition", row_key = "{queueTrigger}")]
pub fn log_row(trigger: QueueTrigger, table: Table) {
    info!("Row: {:?}", table.rows().nth(0));
}

Run an Azure Storage table query based on a HTTP request:

use azure_functions::bindings::{HttpRequest, Table};
use azure_functions::func;
use log::info;

#[func]
#[binding(name = "table", table_name = "MyTable", filter = "{filter}")]
pub fn log_rows(req: HttpRequest, table: Table) {
    for row in table.rows() {
        info!("Row: {:?}", row);
    }
}

Methods

impl Table[src]

pub fn new() -> Table[src]

Creates a new table binding.

The new table binding can be used for output.

pub fn is_empty(&self) -> bool[src]

Gets whether or not the table binding is empty (no rows).

pub fn len(&self) -> usize[src]

Gets the current length of the rows stored in the table binding.

pub fn rows(&self) -> impl Iterator<Item = &Row>[src]

Gets the iterator over the rows stored in the table binding.

For input bindings, this will be the rows returned from either a single entity lookup or a filter query.

For output bindings, this will be the rows that have been added to the table binding.

pub fn add_row(&mut self, partition_key: &str, row_key: &str) -> &mut Row[src]

Adds a new row to the table binding with the specified partition and row keys.

pub fn add_row_value(&mut self, value: Value)[src]

Adds a row as a value to the table.

pub fn as_value(&self) -> &Value[src]

Gets the table as a JSON value.

Trait Implementations

impl Into<Value> for Table[src]

impl<'a> Into<Body<'a>> for Table[src]

impl Clone for Table[src]

impl Default for Table[src]

impl Display for Table[src]

impl Debug for Table[src]

Auto Trait Implementations

impl Send for Table

impl Sync for Table

impl Unpin for Table

impl UnwindSafe for Table

impl RefUnwindSafe for Table

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> IntoRequest<T> for T[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,