pub struct ViewConfigUpdate {
pub group_by: Option<Vec<String>>,
pub split_by: Option<Vec<String>>,
pub columns: Option<Vec<Option<String>>>,
pub filter: Option<Vec<Filter>>,
pub sort: Option<Vec<Sort>>,
pub expressions: Option<Expressions>,
pub aggregates: Option<HashMap<String, Aggregate>>,
pub group_by_depth: Option<u32>,
pub filter_op: Option<FilterReducer>,
}
Fields§
§group_by: Option<Vec<String>>
A group by groups the dataset by the unique values of each column used
as a group by - a close analogue in SQL to the GROUP BY
statement.
The underlying dataset is aggregated to show the values belonging to
each group, and a total row is calculated for each group, showing
the currently selected aggregated value (e.g. sum
) of the column.
Group by are useful for hierarchies, categorizing data and
attributing values, i.e. showing the number of units sold based on
State and City. In Perspective, group by are represented as an array
of string column names to pivot, are applied in the order provided;
For example, a group by of ["State", "City", "Postal Code"]
shows
the values for each Postal Code, which are grouped by City,
which are in turn grouped by State.
split_by: Option<Vec<String>>
A split by splits the dataset by the unique values of each column used
as a split by. The underlying dataset is not aggregated, and a new
column is created for each unique value of the split by. Each newly
created column contains the parts of the dataset that correspond to
the column header, i.e. a View
that has ["State"]
as its split
by will have a new column for each state. In Perspective, Split By
are represented as an array of string column names to pivot.
columns: Option<Vec<Option<String>>>
The columns
property specifies which columns should be included in the
crate::View
’s output. This allows users to show or hide a specific
subset of columns, as well as control the order in which columns
appear to the user. This is represented in Perspective as an array
of string column names.
filter: Option<Vec<Filter>>
The filter
property specifies columns on which the query can be
filtered, returning rows that pass the specified filter condition.
This is analogous to the WHERE
clause in SQL. There is no limit on
the number of columns where filter
is applied, but the resulting
dataset is one that passes all the filter conditions, i.e. the
filters are joined with an AND
condition.
Perspective represents filter
as an array of arrays, with the values
of each inner array being a string column name, a string filter
operator, and a filter operand in the type of the column.
sort: Option<Vec<Sort>>
The sort
property specifies columns on which the query should be
sorted, analogous to ORDER BY
in SQL. A column can be sorted
regardless of its data type, and sorts can be applied in ascending
or descending order. Perspective represents sort
as an array of
arrays, with the values of each inner array being a string column
name and a string sort direction. When column-pivots
are applied,
the additional sort directions "col asc"
and "col desc"
will
determine the order of pivot columns groups.
expressions: Option<Expressions>
The expressions
property specifies new columns in Perspective that
are created using existing column values or arbitary scalar values
defined within the expression. In <perspective-viewer>
,
expressions are added using the “New Column” button in the side
panel.
aggregates: Option<HashMap<String, Aggregate>>
Aggregates perform a calculation over an entire column, and are
displayed when one or more Group By are applied to the
View
. Aggregates can be specified by the user, or Perspective will
use the following sensible default aggregates based on column type:
- “sum” for
integer
andfloat
columns - “count” for all other columns
Perspective provides a selection of aggregate functions that can be
applied to columns in the View
constructor using a dictionary of
column name to aggregate function name.
group_by_depth: Option<u32>
§filter_op: Option<FilterReducer>
Trait Implementations§
Source§impl Clone for ViewConfigUpdate
impl Clone for ViewConfigUpdate
Source§fn clone(&self) -> ViewConfigUpdate
fn clone(&self) -> ViewConfigUpdate
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ViewConfigUpdate
impl Debug for ViewConfigUpdate
Source§impl Default for ViewConfigUpdate
impl Default for ViewConfigUpdate
Source§fn default() -> ViewConfigUpdate
fn default() -> ViewConfigUpdate
Source§impl<'de> Deserialize<'de> for ViewConfigUpdate
impl<'de> Deserialize<'de> for ViewConfigUpdate
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ViewConfigUpdate, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ViewConfigUpdate, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<ViewConfig> for ViewConfigUpdate
impl From<ViewConfig> for ViewConfigUpdate
Source§fn from(value: ViewConfig) -> ViewConfigUpdate
fn from(value: ViewConfig) -> ViewConfigUpdate
Source§impl Serialize for ViewConfigUpdate
impl Serialize for ViewConfigUpdate
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl TS for ViewConfigUpdate
impl TS for ViewConfigUpdate
Source§type WithoutGenerics = ViewConfigUpdate
type WithoutGenerics = ViewConfigUpdate
WithoutGenerics
should just be Self
.
If the type does have generic parameters, then all generic parameters must be replaced with
a dummy type, e.g ts_rs::Dummy
or ()
.
The only requirement for these dummy types is that EXPORT_TO
must be None
. Read moreSource§type OptionInnerType = ViewConfigUpdate
type OptionInnerType = ViewConfigUpdate
std::option::Option<T>
, then this associated type is set to T
.
All other implementations of TS
should set this type to Self
instead.Source§fn decl_concrete() -> String
fn decl_concrete() -> String
TS::decl()
.
If this type is not generic, then this function is equivalent to TS::decl()
.Source§fn decl() -> String
fn decl() -> String
type User = { user_id: number, ... }
.
This function will panic if the type has no declaration. Read moreSource§fn inline() -> String
fn inline() -> String
{ user_id: number }
.
This function will panic if the type cannot be inlined.Source§fn inline_flattened() -> String
fn inline_flattened() -> String
This function will panic if the type cannot be flattened.
Source§fn visit_generics(v: &mut impl TypeVisitor)where
ViewConfigUpdate: 'static,
fn visit_generics(v: &mut impl TypeVisitor)where
ViewConfigUpdate: 'static,
Source§fn output_path() -> Option<PathBuf>
fn output_path() -> Option<PathBuf>
T
should be exported.The returned path does not include the base directory from
TS_RS_EXPORT_DIR
. Read moreSource§fn visit_dependencies(v: &mut impl TypeVisitor)where
ViewConfigUpdate: 'static,
fn visit_dependencies(v: &mut impl TypeVisitor)where
ViewConfigUpdate: 'static,
Source§fn docs() -> Option<String>
fn docs() -> Option<String>
TS
is derived, docs are
automatically read from your doc comments or #[doc = ".."]
attributesSource§fn dependencies() -> Vec<Dependency>where
Self: 'static,
fn dependencies() -> Vec<Dependency>where
Self: 'static,
Source§fn export() -> Result<(), ExportError>where
Self: 'static,
fn export() -> Result<(), ExportError>where
Self: 'static,
TS::export_all
. Read moreSource§fn export_all() -> Result<(), ExportError>where
Self: 'static,
fn export_all() -> Result<(), ExportError>where
Self: 'static,
To export only this type, without its dependencies, use
TS::export
. Read moreSource§fn export_all_to(out_dir: impl AsRef<Path>) -> Result<(), ExportError>where
Self: 'static,
fn export_all_to(out_dir: impl AsRef<Path>) -> Result<(), ExportError>where
Self: 'static,
To export only this type, without its dependencies, use
TS::export
. Read moreSource§fn export_to_string() -> Result<String, ExportError>where
Self: 'static,
fn export_to_string() -> Result<String, ExportError>where
Self: 'static,
Auto Trait Implementations§
impl Freeze for ViewConfigUpdate
impl RefUnwindSafe for ViewConfigUpdate
impl Send for ViewConfigUpdate
impl Sync for ViewConfigUpdate
impl Unpin for ViewConfigUpdate
impl UnwindSafe for ViewConfigUpdate
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more