Expand description
Upgrades persisted Perspective configs — engine ViewConfigs,
<perspective-viewer> tokens and workspaces — written by any release since
2.0.0 to the current schema.
use perspective_migrate::{Kind, Migrator};
use serde_json::json;
let migrated = Migrator::new()
.migrate(Kind::View, Some("2.6.0"), json!({
"row_pivot": ["State"],
"expressions": ["//profit\n\"Sales\" - \"Cost\""]
}))
.unwrap();
assert_eq!(migrated.value, json!({
"group_by": ["State"],
"expressions": {"profit": "\"Sales\" - \"Cost\""}
}));Structs§
- Migrated
- A migrated config and what the migration could not carry over exactly.
- Migrator
- Upgrades configs through every schema change since their source version.
- Step
- One schema change:
applyruns on every object it concerns when the source version predatesat. - StepCx
- The context a
Stepruns in. - Validate
Error - Where and why a config is not valid for the current schema.
- Version
- A Perspective release, ordered by
major.minor.patchwith any pre-release or build suffix ignored.
Enums§
- Form
- Which shape of a config
validaterequires. - Kind
- The kind of document a config is.
- Migrate
Error - Why a config could not be migrated to a valid current form.
- Notice
- Information a migration could not carry into the current schema exactly.
Traits§
- Plugin
Migration - The migrations of a plugin’s
plugin_configandcolumns_config, whoseStep::atversions are the Perspective release that wrote a token rather than releases of the plugin itself.
Functions§
- migrate
- Upgrade a persisted Perspective config to the current schema, returning
{value, notices, steps}. - validate
- Check that
valueis a validkindconfig of the givenformfor the current schema, without migrating it. - validate_
config - Check that a config is valid for the current schema without migrating it,
where
strictrequires the completesave()form.