Skip to main content

Output

Struct Output 

Source
pub struct Output {
    pub name: Option<Loose<String>>,
    pub format: Option<Loose<String>>,
    pub queries: Option<Loose<Vec<String>>>,
    pub when: Option<Loose<OneOf<String, bool>>>,
    pub destination: Option<Loose<OneOf<Destination, Vec<Loose<Destination>>>>>,
    pub template: Option<Loose<Template>>,
    pub for_each: Option<Loose<OneOf<ForEach, bool>>>,
    pub file_name: Option<Loose<String>>,
    pub on_empty: Option<Loose<OnEmpty>>,
    pub extension: Maybe<Loose<Option<OneOf<String, bool>>>>,
    pub options: Map<Value>,
}
Expand description

How a report’s result is written and where it goes. Besides the keys below, each format takes its own options (for example delimiter for delimited, columns for fixed_width, text for message); they are documented with the formats.

Fields§

§name: Option<Loose<String>>

Names the output so other outputs and Set overrides can refer to it (outputs.<name> in a message, attach:). Also the default file name (<name>.<ext>). Unique within the report.

§format: Option<Loose<String>>

The output format: message (built in: a short headline rendered from the results), or csv, delimited, fixed_width, parquet or xlsx (each a plugin). Default: csv, or the project’s default_output.

§queries: Option<Loose<Vec<String>>>

Which of the report’s queries this output formats. Default: all of them. Each query runs once, whatever the number of outputs.

§when: Option<Loose<OneOf<String, bool>>>

A Jinja expression over the results (results.<query>.value < 0); when it’s false, the output is skipped and recorded as skipped.

§destination: Option<Loose<OneOf<Destination, Vec<Loose<Destination>>>>>

Where to deliver the file: one destination, or a list to deliver to several in one run. Default: the file stays in the target path.

§template: Option<Loose<Template>>§for_each: Option<Loose<OneOf<ForEach, bool>>>

One copy of the output per row of a driver query ({query: members, key: member_id}), each with its own slice of the results and the driver row as each.*; false turns an inherited one off. See docs/per-row-outputs.md.

§file_name: Option<Loose<String>>

A per-row output’s file name, with Jinja ("{{ each.member_id }}_statement.pdf"). Default: the row’s key and the format’s extension, under a folder named after the output.

§on_empty: Option<Loose<OnEmpty>>

When every query of the output returns no rows: continue (default) writes and delivers it empty, with a warning; skip writes and delivers nothing; fail fails the run. A query’s own on_empty wins. See “When there’s no data” in docs/building-reports.md.

§extension: Maybe<Loose<Option<OneOf<String, bool>>>>

File extension for text formats (e.g. aba), instead of the format’s own. "" or false means none. Not for xlsx.

§options: Map<Value>

The format’s own options.

Trait Implementations§

Source§

impl<'de> Deserialize<'de> for Output

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for Output

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.