Skip to main content

nominal_api/conjure/objects/storage/writer/api/
write_batches_request.rs

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    conjure_object::private::DeriveWith
7)]
8#[serde(crate = "conjure_object::serde")]
9#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
10#[conjure_object::private::staged_builder::staged_builder]
11#[builder(crate = conjure_object::private::staged_builder, update, inline)]
12pub struct WriteBatchesRequest {
13    #[builder(default, list(item(type = super::RecordsBatch)))]
14    #[serde(rename = "batches", skip_serializing_if = "Vec::is_empty", default)]
15    batches: Vec<super::RecordsBatch>,
16    #[serde(rename = "dataSourceRid")]
17    data_source_rid: conjure_object::ResourceIdentifier,
18    #[builder(default, into)]
19    #[serde(
20        rename = "asynchronousInsert",
21        skip_serializing_if = "Option::is_none",
22        default
23    )]
24    asynchronous_insert: Option<bool>,
25}
26impl WriteBatchesRequest {
27    /// Constructs a new instance of the type.
28    #[inline]
29    pub fn new(data_source_rid: conjure_object::ResourceIdentifier) -> Self {
30        Self::builder().data_source_rid(data_source_rid).build()
31    }
32    #[inline]
33    pub fn batches(&self) -> &[super::RecordsBatch] {
34        &*self.batches
35    }
36    #[inline]
37    pub fn data_source_rid(&self) -> &conjure_object::ResourceIdentifier {
38        &self.data_source_rid
39    }
40    /// Is always true - setting this to false will do nothing.
41    #[deprecated(note = "Should not be used.\n")]
42    #[inline]
43    pub fn asynchronous_insert(&self) -> Option<bool> {
44        self.asynchronous_insert.as_ref().map(|o| *o)
45    }
46}