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: super::super::super::super::api::rids::NominalDataSourceOrDatasetRid,
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(
30        data_source_rid: super::super::super::super::api::rids::NominalDataSourceOrDatasetRid,
31    ) -> Self {
32        Self::builder().data_source_rid(data_source_rid).build()
33    }
34    #[inline]
35    pub fn batches(&self) -> &[super::RecordsBatch] {
36        &*self.batches
37    }
38    #[inline]
39    pub fn data_source_rid(
40        &self,
41    ) -> &super::super::super::super::api::rids::NominalDataSourceOrDatasetRid {
42        &self.data_source_rid
43    }
44    /// Is always true - setting this to false will do nothing.
45    #[deprecated(note = "Should not be used.\n")]
46    #[inline]
47    pub fn asynchronous_insert(&self) -> Option<bool> {
48        self.asynchronous_insert.as_ref().map(|o| *o)
49    }
50}