mirror of
https://github.com/nushell/nushell
synced 2024-12-28 05:53:09 +00:00
use from table
to remove into-db command (#6205)
* use from table to remove into-db command * correct tests for db expressions
This commit is contained in:
parent
2ac7a4d48d
commit
1f4791a191
16 changed files with 73 additions and 87 deletions
|
@ -32,17 +32,16 @@ impl Command for AliasDb {
|
||||||
vec![
|
vec![
|
||||||
Example {
|
Example {
|
||||||
description: "Creates an alias for a selected table",
|
description: "Creates an alias for a selected table",
|
||||||
example: r#"open db.mysql
|
example: r#"open db.sqlite
|
||||||
| into db
|
| from table table_1
|
||||||
| select a
|
| select a
|
||||||
| from table_1
|
|
||||||
| as t1
|
| as t1
|
||||||
| describe"#,
|
| describe"#,
|
||||||
result: Some(Value::Record {
|
result: Some(Value::Record {
|
||||||
cols: vec!["connection".into(), "query".into()],
|
cols: vec!["connection".into(), "query".into()],
|
||||||
vals: vec![
|
vals: vec![
|
||||||
Value::String {
|
Value::String {
|
||||||
val: "db.mysql".into(),
|
val: "db.sqlite".into(),
|
||||||
span: Span::test_data(),
|
span: Span::test_data(),
|
||||||
},
|
},
|
||||||
Value::String {
|
Value::String {
|
||||||
|
@ -55,22 +54,20 @@ impl Command for AliasDb {
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "Creates an alias for a derived table",
|
description: "Creates an alias for a derived table",
|
||||||
example: r#"open db.mysql
|
example: r#"open db.sqlite
|
||||||
| into db
|
| from table (
|
||||||
| select a
|
open db.sqlite
|
||||||
| from (
|
| from table table_a
|
||||||
open db.mysql
|
|
||||||
| into db
|
|
||||||
| select a b
|
| select a b
|
||||||
| from table_a
|
|
||||||
)
|
)
|
||||||
|
| select a
|
||||||
| as t1
|
| as t1
|
||||||
| describe"#,
|
| describe"#,
|
||||||
result: Some(Value::Record {
|
result: Some(Value::Record {
|
||||||
cols: vec!["connection".into(), "query".into()],
|
cols: vec!["connection".into(), "query".into()],
|
||||||
vals: vec![
|
vals: vec![
|
||||||
Value::String {
|
Value::String {
|
||||||
val: "db.mysql".into(),
|
val: "db.sqlite".into(),
|
||||||
span: Span::test_data(),
|
span: Span::test_data(),
|
||||||
},
|
},
|
||||||
Value::String {
|
Value::String {
|
||||||
|
|
|
@ -38,10 +38,9 @@ impl Command for AndDb {
|
||||||
vec![
|
vec![
|
||||||
Example {
|
Example {
|
||||||
description: "Selects a column from a database with an AND clause",
|
description: "Selects a column from a database with an AND clause",
|
||||||
example: r#"open db.mysql
|
example: r#"open db.sqlite
|
||||||
| into db
|
| from table table_1
|
||||||
| select a
|
| select a
|
||||||
| from table_1
|
|
||||||
| where ((field a) > 1)
|
| where ((field a) > 1)
|
||||||
| and ((field b) == 1)
|
| and ((field b) == 1)
|
||||||
| describe"#,
|
| describe"#,
|
||||||
|
@ -49,7 +48,7 @@ impl Command for AndDb {
|
||||||
cols: vec!["connection".into(), "query".into()],
|
cols: vec!["connection".into(), "query".into()],
|
||||||
vals: vec![
|
vals: vec![
|
||||||
Value::String {
|
Value::String {
|
||||||
val: "db.mysql".into(),
|
val: "db.sqlite".into(),
|
||||||
span: Span::test_data(),
|
span: Span::test_data(),
|
||||||
},
|
},
|
||||||
Value::String {
|
Value::String {
|
||||||
|
@ -62,10 +61,9 @@ impl Command for AndDb {
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "Creates a AND clause combined with an expression AND",
|
description: "Creates a AND clause combined with an expression AND",
|
||||||
example: r#"open db.mysql
|
example: r#"open db.sqlite
|
||||||
| into db
|
| from table table_1
|
||||||
| select a
|
| select a
|
||||||
| from table_1
|
|
||||||
| where ((field a) > 1 | and ((field a) < 10))
|
| where ((field a) > 1 | and ((field a) < 10))
|
||||||
| and ((field b) == 1)
|
| and ((field b) == 1)
|
||||||
| describe"#,
|
| describe"#,
|
||||||
|
@ -73,7 +71,7 @@ impl Command for AndDb {
|
||||||
cols: vec!["connection".into(), "query".into()],
|
cols: vec!["connection".into(), "query".into()],
|
||||||
vals: vec![
|
vals: vec![
|
||||||
Value::String {
|
Value::String {
|
||||||
val: "db.mysql".into(),
|
val: "db.sqlite".into(),
|
||||||
span: Span::test_data(),
|
span: Span::test_data(),
|
||||||
},
|
},
|
||||||
Value::String {
|
Value::String {
|
||||||
|
|
|
@ -28,7 +28,7 @@ impl Command for CollectDb {
|
||||||
fn examples(&self) -> Vec<Example> {
|
fn examples(&self) -> Vec<Example> {
|
||||||
vec![Example {
|
vec![Example {
|
||||||
description: "Collect from a select query",
|
description: "Collect from a select query",
|
||||||
example: "open foo.db | into db | select a | from table_1 | collect",
|
example: "open foo.db | from table table_1 db | select a | collect",
|
||||||
result: None,
|
result: None,
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ impl Command for DescribeDb {
|
||||||
fn examples(&self) -> Vec<Example> {
|
fn examples(&self) -> Vec<Example> {
|
||||||
vec![Example {
|
vec![Example {
|
||||||
description: "Describe SQLite database constructed query",
|
description: "Describe SQLite database constructed query",
|
||||||
example: "open foo.db | into db | select col_1 | from table_1 | describe",
|
example: "open foo.db | from table table_1 | select col_1 | describe",
|
||||||
result: Some(Value::Record {
|
result: Some(Value::Record {
|
||||||
cols: vec!["connection".into(), "query".into()],
|
cols: vec!["connection".into(), "query".into()],
|
||||||
vals: vec![
|
vals: vec![
|
||||||
|
|
|
@ -15,7 +15,7 @@ pub struct FromDb;
|
||||||
|
|
||||||
impl Command for FromDb {
|
impl Command for FromDb {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
"from"
|
"from table"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn usage(&self) -> &str {
|
fn usage(&self) -> &str {
|
||||||
|
@ -35,7 +35,7 @@ impl Command for FromDb {
|
||||||
"Alias for the selected table",
|
"Alias for the selected table",
|
||||||
Some('a'),
|
Some('a'),
|
||||||
)
|
)
|
||||||
.input_type(Type::Custom("database".into()))
|
.input_type(Type::Any)
|
||||||
.output_type(Type::Custom("database".into()))
|
.output_type(Type::Custom("database".into()))
|
||||||
.category(Category::Custom("database".into()))
|
.category(Category::Custom("database".into()))
|
||||||
}
|
}
|
||||||
|
@ -47,12 +47,12 @@ impl Command for FromDb {
|
||||||
fn examples(&self) -> Vec<Example> {
|
fn examples(&self) -> Vec<Example> {
|
||||||
vec![Example {
|
vec![Example {
|
||||||
description: "Selects a table from database",
|
description: "Selects a table from database",
|
||||||
example: "open db.mysql | into db | from table_a | describe",
|
example: "open db.sqlite | from table table_a | describe",
|
||||||
result: Some(Value::Record {
|
result: Some(Value::Record {
|
||||||
cols: vec!["connection".into(), "query".into()],
|
cols: vec!["connection".into(), "query".into()],
|
||||||
vals: vec![
|
vals: vec![
|
||||||
Value::String {
|
Value::String {
|
||||||
val: "db.mysql".into(),
|
val: "db.sqlite".into(),
|
||||||
span: Span::test_data(),
|
span: Span::test_data(),
|
||||||
},
|
},
|
||||||
Value::String {
|
Value::String {
|
||||||
|
|
|
@ -42,9 +42,8 @@ impl Command for GroupByDb {
|
||||||
vec![
|
vec![
|
||||||
Example {
|
Example {
|
||||||
description: "groups by column a and calculates the max",
|
description: "groups by column a and calculates the max",
|
||||||
example: r#"open db.mysql
|
example: r#"open db.sqlite
|
||||||
| into db
|
| from table table_a
|
||||||
| from table_a
|
|
||||||
| select (fn max a)
|
| select (fn max a)
|
||||||
| group-by a
|
| group-by a
|
||||||
| describe"#,
|
| describe"#,
|
||||||
|
@ -52,7 +51,7 @@ impl Command for GroupByDb {
|
||||||
cols: vec!["connection".into(), "query".into()],
|
cols: vec!["connection".into(), "query".into()],
|
||||||
vals: vec![
|
vals: vec![
|
||||||
Value::String {
|
Value::String {
|
||||||
val: "db.mysql".into(),
|
val: "db.sqlite".into(),
|
||||||
span: Span::test_data(),
|
span: Span::test_data(),
|
||||||
},
|
},
|
||||||
Value::String {
|
Value::String {
|
||||||
|
@ -65,9 +64,8 @@ impl Command for GroupByDb {
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "groups by column column a and counts records",
|
description: "groups by column column a and counts records",
|
||||||
example: r#"open db.mysql
|
example: r#"open db.sqlite
|
||||||
| into db
|
| from table table_a
|
||||||
| from table_a
|
|
||||||
| select (fn count *)
|
| select (fn count *)
|
||||||
| group-by a
|
| group-by a
|
||||||
| describe"#,
|
| describe"#,
|
||||||
|
@ -75,7 +73,7 @@ impl Command for GroupByDb {
|
||||||
cols: vec!["connection".into(), "query".into()],
|
cols: vec!["connection".into(), "query".into()],
|
||||||
vals: vec![
|
vals: vec![
|
||||||
Value::String {
|
Value::String {
|
||||||
val: "db.mysql".into(),
|
val: "db.sqlite".into(),
|
||||||
span: Span::test_data(),
|
span: Span::test_data(),
|
||||||
},
|
},
|
||||||
Value::String {
|
Value::String {
|
||||||
|
|
|
@ -54,17 +54,16 @@ impl Command for JoinDb {
|
||||||
vec![
|
vec![
|
||||||
Example {
|
Example {
|
||||||
description: "joins two tables on col_b",
|
description: "joins two tables on col_b",
|
||||||
example: r#"open db.mysql
|
example: r#"open db.sqlite
|
||||||
| into db
|
| from table table_1 --as t1
|
||||||
| select col_a
|
|
||||||
| from table_1 --as t1
|
|
||||||
| join table_2 col_b --as t2
|
| join table_2 col_b --as t2
|
||||||
|
| select col_a
|
||||||
| describe"#,
|
| describe"#,
|
||||||
result: Some(Value::Record {
|
result: Some(Value::Record {
|
||||||
cols: vec!["connection".into(), "query".into()],
|
cols: vec!["connection".into(), "query".into()],
|
||||||
vals: vec![
|
vals: vec![
|
||||||
Value::String {
|
Value::String {
|
||||||
val: "db.mysql".into(),
|
val: "db.sqlite".into(),
|
||||||
span: Span::test_data(),
|
span: Span::test_data(),
|
||||||
},
|
},
|
||||||
Value::String {
|
Value::String {
|
||||||
|
@ -78,22 +77,20 @@ impl Command for JoinDb {
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "joins a table with a derived table using aliases",
|
description: "joins a table with a derived table using aliases",
|
||||||
example: r#"open db.mysql
|
example: r#"open db.sqlite
|
||||||
| into db
|
| from table table_1 --as t1
|
||||||
| select col_a
|
|
||||||
| from table_1 --as t1
|
|
||||||
| join (
|
| join (
|
||||||
open db.mysql
|
open db.sqlite
|
||||||
| into db
|
| from table table_2
|
||||||
| select col_c
|
| select col_c
|
||||||
| from table_2
|
|
||||||
) ((field t1.col_a) == (field t2.col_c)) --as t2 --right
|
) ((field t1.col_a) == (field t2.col_c)) --as t2 --right
|
||||||
|
| select col_a
|
||||||
| describe"#,
|
| describe"#,
|
||||||
result: Some(Value::Record {
|
result: Some(Value::Record {
|
||||||
cols: vec!["connection".into(), "query".into()],
|
cols: vec!["connection".into(), "query".into()],
|
||||||
vals: vec![
|
vals: vec![
|
||||||
Value::String {
|
Value::String {
|
||||||
val: "db.mysql".into(),
|
val: "db.sqlite".into(),
|
||||||
span: Span::test_data(),
|
span: Span::test_data(),
|
||||||
},
|
},
|
||||||
Value::String {
|
Value::String {
|
||||||
|
|
|
@ -40,9 +40,8 @@ impl Command for LimitDb {
|
||||||
fn examples(&self) -> Vec<Example> {
|
fn examples(&self) -> Vec<Example> {
|
||||||
vec![Example {
|
vec![Example {
|
||||||
description: "Limits selection from table",
|
description: "Limits selection from table",
|
||||||
example: r#"open db.mysql
|
example: r#"open db.sqlite
|
||||||
| into db
|
| from table table_a
|
||||||
| from table_a
|
|
||||||
| select a
|
| select a
|
||||||
| limit 10
|
| limit 10
|
||||||
| describe"#,
|
| describe"#,
|
||||||
|
@ -50,7 +49,7 @@ impl Command for LimitDb {
|
||||||
cols: vec!["connection".into(), "query".into()],
|
cols: vec!["connection".into(), "query".into()],
|
||||||
vals: vec![
|
vals: vec![
|
||||||
Value::String {
|
Value::String {
|
||||||
val: "db.mysql".into(),
|
val: "db.sqlite".into(),
|
||||||
span: Span::test_data(),
|
span: Span::test_data(),
|
||||||
},
|
},
|
||||||
Value::String {
|
Value::String {
|
||||||
|
|
|
@ -38,10 +38,9 @@ impl Command for OrDb {
|
||||||
vec![
|
vec![
|
||||||
Example {
|
Example {
|
||||||
description: "selects a column from a database with an OR clause",
|
description: "selects a column from a database with an OR clause",
|
||||||
example: r#"open db.mysql
|
example: r#"open db.sqlite
|
||||||
| into db
|
| from table table_1
|
||||||
| select a
|
| select a
|
||||||
| from table_1
|
|
||||||
| where ((field a) > 1)
|
| where ((field a) > 1)
|
||||||
| or ((field b) == 1)
|
| or ((field b) == 1)
|
||||||
| describe"#,
|
| describe"#,
|
||||||
|
@ -49,7 +48,7 @@ impl Command for OrDb {
|
||||||
cols: vec!["connection".into(), "query".into()],
|
cols: vec!["connection".into(), "query".into()],
|
||||||
vals: vec![
|
vals: vec![
|
||||||
Value::String {
|
Value::String {
|
||||||
val: "db.mysql".into(),
|
val: "db.sqlite".into(),
|
||||||
span: Span::test_data(),
|
span: Span::test_data(),
|
||||||
},
|
},
|
||||||
Value::String {
|
Value::String {
|
||||||
|
@ -62,10 +61,9 @@ impl Command for OrDb {
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "Creates an OR clause in the column names and a column",
|
description: "Creates an OR clause in the column names and a column",
|
||||||
example: r#"open db.mysql
|
example: r#"open db.sqlite
|
||||||
| into db
|
| from table table_1
|
||||||
| select a
|
| select a
|
||||||
| from table_1
|
|
||||||
| where ((field a) > 1 | or ((field a) < 10))
|
| where ((field a) > 1 | or ((field a) < 10))
|
||||||
| or ((field b) == 1)
|
| or ((field b) == 1)
|
||||||
| describe"#,
|
| describe"#,
|
||||||
|
@ -73,7 +71,7 @@ impl Command for OrDb {
|
||||||
cols: vec!["connection".into(), "query".into()],
|
cols: vec!["connection".into(), "query".into()],
|
||||||
vals: vec![
|
vals: vec![
|
||||||
Value::String {
|
Value::String {
|
||||||
val: "db.mysql".into(),
|
val: "db.sqlite".into(),
|
||||||
span: Span::test_data(),
|
span: Span::test_data(),
|
||||||
},
|
},
|
||||||
Value::String {
|
Value::String {
|
||||||
|
|
|
@ -44,9 +44,8 @@ impl Command for OrderByDb {
|
||||||
vec![
|
vec![
|
||||||
Example {
|
Example {
|
||||||
description: "orders query by a column",
|
description: "orders query by a column",
|
||||||
example: r#"open db.mysql
|
example: r#"open db.sqlite
|
||||||
| into db
|
| from table table_a
|
||||||
| from table_a
|
|
||||||
| select a
|
| select a
|
||||||
| order-by a
|
| order-by a
|
||||||
| describe"#,
|
| describe"#,
|
||||||
|
@ -54,7 +53,7 @@ impl Command for OrderByDb {
|
||||||
cols: vec!["connection".into(), "query".into()],
|
cols: vec!["connection".into(), "query".into()],
|
||||||
vals: vec![
|
vals: vec![
|
||||||
Value::String {
|
Value::String {
|
||||||
val: "db.mysql".into(),
|
val: "db.sqlite".into(),
|
||||||
span: Span::test_data(),
|
span: Span::test_data(),
|
||||||
},
|
},
|
||||||
Value::String {
|
Value::String {
|
||||||
|
@ -67,9 +66,8 @@ impl Command for OrderByDb {
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "orders query by column a ascending and by column b",
|
description: "orders query by column a ascending and by column b",
|
||||||
example: r#"open db.mysql
|
example: r#"open db.sqlite
|
||||||
| into db
|
| from table table_a
|
||||||
| from table_a
|
|
||||||
| select a
|
| select a
|
||||||
| order-by a --ascending
|
| order-by a --ascending
|
||||||
| order-by b
|
| order-by b
|
||||||
|
@ -78,7 +76,7 @@ impl Command for OrderByDb {
|
||||||
cols: vec!["connection".into(), "query".into()],
|
cols: vec!["connection".into(), "query".into()],
|
||||||
vals: vec![
|
vals: vec![
|
||||||
Value::String {
|
Value::String {
|
||||||
val: "db.mysql".into(),
|
val: "db.sqlite".into(),
|
||||||
span: Span::test_data(),
|
span: Span::test_data(),
|
||||||
},
|
},
|
||||||
Value::String {
|
Value::String {
|
||||||
|
|
|
@ -16,7 +16,7 @@ impl Command for SchemaDb {
|
||||||
|
|
||||||
fn signature(&self) -> Signature {
|
fn signature(&self) -> Signature {
|
||||||
Signature::build(self.name())
|
Signature::build(self.name())
|
||||||
.input_type(Type::Custom("database".into()))
|
.input_type(Type::Any)
|
||||||
.output_type(Type::Any)
|
.output_type(Type::Any)
|
||||||
.category(Category::Custom("database".into()))
|
.category(Category::Custom("database".into()))
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ impl Command for SchemaDb {
|
||||||
fn examples(&self) -> Vec<Example> {
|
fn examples(&self) -> Vec<Example> {
|
||||||
vec![Example {
|
vec![Example {
|
||||||
description: "Show the schema of a SQLite database",
|
description: "Show the schema of a SQLite database",
|
||||||
example: r#"open foo.db | into db | schema"#,
|
example: r#"open foo.db | schema"#,
|
||||||
result: None,
|
result: None,
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,12 +40,12 @@ impl Command for ProjectionDb {
|
||||||
vec![
|
vec![
|
||||||
Example {
|
Example {
|
||||||
description: "selects a column from a database",
|
description: "selects a column from a database",
|
||||||
example: "open db.mysql | into db | select a | describe",
|
example: "open db.sqlite | into db | select a | describe",
|
||||||
result: Some(Value::Record {
|
result: Some(Value::Record {
|
||||||
cols: vec!["connection".into(), "query".into()],
|
cols: vec!["connection".into(), "query".into()],
|
||||||
vals: vec![
|
vals: vec![
|
||||||
Value::String {
|
Value::String {
|
||||||
val: "db.mysql".into(),
|
val: "db.sqlite".into(),
|
||||||
span: Span::test_data(),
|
span: Span::test_data(),
|
||||||
},
|
},
|
||||||
Value::String {
|
Value::String {
|
||||||
|
@ -58,16 +58,16 @@ impl Command for ProjectionDb {
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "selects columns from a database using alias",
|
description: "selects columns from a database using alias",
|
||||||
example: r#"open db.mysql
|
example: r#"open db.sqlite
|
||||||
| into db
|
| into db
|
||||||
| select (field a | as new_a) b c
|
| select (field a | as new_a) b c
|
||||||
| from table_1
|
| from table table_1
|
||||||
| describe"#,
|
| describe"#,
|
||||||
result: Some(Value::Record {
|
result: Some(Value::Record {
|
||||||
cols: vec!["connection".into(), "query".into()],
|
cols: vec!["connection".into(), "query".into()],
|
||||||
vals: vec![
|
vals: vec![
|
||||||
Value::String {
|
Value::String {
|
||||||
val: "db.mysql".into(),
|
val: "db.sqlite".into(),
|
||||||
span: Span::test_data(),
|
span: Span::test_data(),
|
||||||
},
|
},
|
||||||
Value::String {
|
Value::String {
|
||||||
|
|
|
@ -18,6 +18,10 @@ impl Command for ToDataBase {
|
||||||
"Converts into an open db connection"
|
"Converts into an open db connection"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn extra_usage(&self) -> &str {
|
||||||
|
"This function is used as type hint for parser, specially if the query is not started with 'from table'"
|
||||||
|
}
|
||||||
|
|
||||||
fn signature(&self) -> Signature {
|
fn signature(&self) -> Signature {
|
||||||
Signature::build(self.name())
|
Signature::build(self.name())
|
||||||
.input_type(Type::Any)
|
.input_type(Type::Any)
|
||||||
|
@ -32,7 +36,7 @@ impl Command for ToDataBase {
|
||||||
fn examples(&self) -> Vec<Example> {
|
fn examples(&self) -> Vec<Example> {
|
||||||
vec![Example {
|
vec![Example {
|
||||||
description: "Converts an open file into a db object",
|
description: "Converts an open file into a db object",
|
||||||
example: "open db.mysql | into db",
|
example: "open db.sqlite | into db",
|
||||||
result: None,
|
result: None,
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,17 +37,16 @@ impl Command for WhereDb {
|
||||||
fn examples(&self) -> Vec<Example> {
|
fn examples(&self) -> Vec<Example> {
|
||||||
vec![Example {
|
vec![Example {
|
||||||
description: "selects a column from a database with a where clause",
|
description: "selects a column from a database with a where clause",
|
||||||
example: r#"open db.mysql
|
example: r#"open db.sqlite
|
||||||
| into db
|
| from table table_1
|
||||||
| select a
|
| select a
|
||||||
| from table_1
|
|
||||||
| where ((field a) > 1)
|
| where ((field a) > 1)
|
||||||
| describe"#,
|
| describe"#,
|
||||||
result: Some(Value::Record {
|
result: Some(Value::Record {
|
||||||
cols: vec!["connection".into(), "query".into()],
|
cols: vec!["connection".into(), "query".into()],
|
||||||
vals: vec![
|
vals: vec![
|
||||||
Value::String {
|
Value::String {
|
||||||
val: "db.mysql".into(),
|
val: "db.sqlite".into(),
|
||||||
span: Span::test_data(),
|
span: Span::test_data(),
|
||||||
},
|
},
|
||||||
Value::String {
|
Value::String {
|
||||||
|
|
|
@ -68,16 +68,15 @@ impl Command for FunctionExpr {
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "orders query by a column",
|
description: "orders query by a column",
|
||||||
example: r#"open db.mysql
|
example: r#"open db.sqlite
|
||||||
| into db
|
| from table table_a
|
||||||
| select (fn lead col_a)
|
| select (fn lead col_a)
|
||||||
| from table_a
|
|
||||||
| describe"#,
|
| describe"#,
|
||||||
result: Some(Value::Record {
|
result: Some(Value::Record {
|
||||||
cols: vec!["connection".into(), "query".into()],
|
cols: vec!["connection".into(), "query".into()],
|
||||||
vals: vec![
|
vals: vec![
|
||||||
Value::String {
|
Value::String {
|
||||||
val: "db.mysql".into(),
|
val: "db.sqlite".into(),
|
||||||
span: Span::test_data(),
|
span: Span::test_data(),
|
||||||
},
|
},
|
||||||
Value::String {
|
Value::String {
|
||||||
|
|
|
@ -69,16 +69,15 @@ impl Command for OverExpr {
|
||||||
},
|
},
|
||||||
Example {
|
Example {
|
||||||
description: "orders query by a column",
|
description: "orders query by a column",
|
||||||
example: r#"open db.mysql
|
example: r#"open db.sqlite
|
||||||
| into db
|
| from table table_a
|
||||||
| select (fn lead col_a | over col_b)
|
| select (fn lead col_a | over col_b)
|
||||||
| from table_a
|
|
||||||
| describe"#,
|
| describe"#,
|
||||||
result: Some(Value::Record {
|
result: Some(Value::Record {
|
||||||
cols: vec!["connection".into(), "query".into()],
|
cols: vec!["connection".into(), "query".into()],
|
||||||
vals: vec![
|
vals: vec![
|
||||||
Value::String {
|
Value::String {
|
||||||
val: "db.mysql".into(),
|
val: "db.sqlite".into(),
|
||||||
span: Span::test_data(),
|
span: Span::test_data(),
|
||||||
},
|
},
|
||||||
Value::String {
|
Value::String {
|
||||||
|
|
Loading…
Reference in a new issue