[−][src]Struct azure_functions::bindings::Table
Represents an Azure Storage table input or output binding.
The following binding attributes are supported:
Name | Description |
---|---|
name | The name of the parameter being bound. |
table_name | The name of the table. |
partition_key | The partition key of the table entity to read or write. |
row_key | The row key of the table entity to read or write. |
filter | The maximum number of entities to read (optional; input only). |
take | The OData filter expression of entities to read (optional; input only). |
connection | The 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]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> IntoRequest<T> for T
[src]
fn into_request(self) -> Request<T>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,