Skip to main content

diff

Function diff 

Source
pub fn diff(
    source: &Expression,
    target: &Expression,
    delta_only: bool,
) -> Vec<Edit>
Expand description

Compare two expressions and return a list of edits

§Arguments

  • source - The source expression
  • target - The target expression to compare against
  • delta_only - If true, exclude Keep edits from the result

§Returns

A vector of Edit operations that transform source into target

§Example

use polyglot_sql::diff::diff;
use polyglot_sql::parse_one;
use polyglot_sql::DialectType;

let source = parse_one("SELECT a + b FROM t", DialectType::Generic).unwrap();
let target = parse_one("SELECT a + c FROM t", DialectType::Generic).unwrap();
let edits = diff(&source, &target, false);