pub struct Table(/* private fields */);
Expand description
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);
}
}
Implementations§
Source§impl Table
impl Table
Sourcepub fn new() -> Table
pub fn new() -> Table
Creates a new table binding.
The new table binding can be used for output.
Sourcepub fn rows(&self) -> impl Iterator<Item = &Row>
pub fn rows(&self) -> impl Iterator<Item = &Row>
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.
Sourcepub fn add_row(&mut self, partition_key: &str, row_key: &str) -> &mut Row
pub fn add_row(&mut self, partition_key: &str, row_key: &str) -> &mut Row
Adds a new row to the table binding with the specified partition and row keys.
Sourcepub fn add_row_value(&mut self, value: Value)
pub fn add_row_value(&mut self, value: Value)
Adds a row as a value to the table.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Table
impl RefUnwindSafe for Table
impl Send for Table
impl Sync for Table
impl Unpin for Table
impl UnwindSafe for Table
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request