pub struct SplitSchema {
pub sequential: Vec<NextOperation>,
pub keyed: HashMap<String, NextOperation>,
pub remaining: Option<NextOperation>,
pub trace_settings: TraceSettings,
}Expand description
If the input message is a list-like or map-like object, split it into multiple output messages.
Note that the type of output message from the split depends on how the
input message implements the Splittable trait. In many cases this
will be a tuple of (key, value).
There are three ways to specify where the split output messages should go, and all can be used at the same time:
sequential- For array-like collections, send the “first” element of the collection to the first operation listed in thesequentialarray. The “second” element of the collection goes to the second operation listed in thesequentialarray. And so on for all elements in the collection. If one of the elements in the collection is mentioned in thekeyedset, then the sequence will pass over it as if the element does not exist at all.keyed- For map-like collections, send the split element associated with the specified key to its associated output.remaining- Any elements that are were not captured bysequentialor bykeyedwill be sent to this.
§Examples
Suppose I am an animal rescuer sorting through a new collection of animals that need recuing. My home has space for three exotic animals plus any number of dogs and cats.
I have a custom SpeciesCollection data structure that implements
Splittable by allowing you to key on the type of animal.
In the workflow below, we send all cats and dogs to home, and we also
send the first three non-dog and non-cat species to home. All
remaining animals go to the zoo.
{
"version": "0.1.0",
"start": "select_animals",
"ops": {
"select_animals": {
"type": "split",
"sequential": [
"home",
"home",
"home"
],
"keyed": {
"cat": "home",
"dog": "home"
},
"remaining": "zoo"
}
}
}If we input ["frog", "cat", "bear", "beaver", "dog", "rabbit", "dog", "monkey"]
then frog, bear, and beaver will be sent to home since those are
the first three animals that are not dog or cat, and we will also
send one cat and two dog home. rabbit and monkey will be sent to the zoo.
Fields§
§sequential: Vec<NextOperation>§keyed: HashMap<String, NextOperation>§remaining: Option<NextOperation>§trace_settings: TraceSettingsTrait Implementations§
Source§impl BuildDiagramOperation for SplitSchema
impl BuildDiagramOperation for SplitSchema
fn build_diagram_operation( &self, id: &OperationName, ctx: &mut DiagramContext<'_, '_, '_, '_, '_>, ) -> Result<BuildStatus, DiagramErrorCode>
Source§impl Clone for SplitSchema
impl Clone for SplitSchema
Source§fn clone(&self) -> SplitSchema
fn clone(&self) -> SplitSchema
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SplitSchema
impl Debug for SplitSchema
Source§impl<'de> Deserialize<'de> for SplitSchema
impl<'de> Deserialize<'de> for SplitSchema
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for SplitSchema
impl JsonSchema for SplitSchema
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§fn always_inline_schema() -> bool
fn always_inline_schema() -> bool
Use inline_schema() instead
inline_schema() instead“. Read moreAuto Trait Implementations§
impl Freeze for SplitSchema
impl RefUnwindSafe for SplitSchema
impl Send for SplitSchema
impl Sync for SplitSchema
impl Unpin for SplitSchema
impl UnsafeUnpin for SplitSchema
impl UnwindSafe for SplitSchema
Blanket Implementations§
Source§impl<Source> AccessAs for Source
impl<Source> AccessAs for Source
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConditionalSend for Twhere
T: Send,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DynType for Twhere
T: JsonSchema,
impl<T> DynType for Twhere
T: JsonSchema,
Source§fn type_name() -> Cow<'static, str>
fn type_name() -> Cow<'static, str>
fn json_schema(generator: &mut SchemaGenerator) -> Schema
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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>
T in a tonic::Request