Skip to content

Commit 8c4a71c

Browse files
committed
Migrate to GitQL SDK 0.23.0
1 parent 1f49ba1 commit 8c4a71c

4 files changed

Lines changed: 39 additions & 34 deletions

File tree

Cargo.lock

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "fileql"
33
authors = ["AmrDeveloper"]
4-
version = "0.4.0"
4+
version = "0.5.0"
55
edition = "2021"
66
description = "A tool to run SQL-like query on local files using GitQL SDK"
77
license = "MIT"
@@ -13,10 +13,10 @@ categories = ["command-line-utilities"]
1313
exclude = [".github/**", "docs/**", "media/**", "scripts/**"]
1414

1515
[dependencies]
16-
gitql-core = "0.1.0"
17-
gitql-std = "0.1.0"
18-
gitql-cli = "0.20.0"
19-
gitql-ast = "0.18.0"
20-
gitql-parser = "0.19.0"
21-
gitql-engine = "0.20.0"
16+
gitql-core = "0.2.0"
17+
gitql-std = "0.2.0"
18+
gitql-cli = "0.23.0"
19+
gitql-ast = "0.20.0"
20+
gitql-parser = "0.22.0"
21+
gitql-engine = "0.23.0"
2222
atty = "0.2.14"

RELEASING.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,9 @@
2323
```
2424

2525
This will trigger a GitHub Action workflow which will create a GitHub release and
26-
publish to Cargo.
26+
publish to Cargo.
27+
28+
# Releasing GitQL SDK crate
29+
30+
1. Update `Cargo.toml` with the new version.
31+
2. `cargo publish --allow-dirty`

src/data_provider.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ impl DataProvider for FileDataProvider {
3030
fields_names: &[String],
3131
titles: &[String],
3232
fields_values: &[Box<dyn Expression>],
33-
) -> GitQLObject {
33+
hidden_selection_count: i64,
34+
) -> Result<GitQLObject, String> {
3435
let mut groups: Vec<Group> = vec![];
3536
if table.is_empty() {
36-
if let Ok(group) = select_values(env, titles, fields_values) {
37-
groups.push(group);
38-
}
37+
let group = select_values(env, titles, fields_values)?;
38+
groups.push(group);
3939

40-
return GitQLObject {
40+
return Ok(GitQLObject {
4141
titles: titles.to_vec(),
4242
groups,
43-
};
43+
});
4444
}
4545

4646
let mut files: Vec<String> = vec![];
@@ -65,17 +65,17 @@ impl DataProvider for FileDataProvider {
6565
let path = Path::new(&file);
6666

6767
for index in 0..names_len {
68-
let field_name = &fields_names[index as usize];
69-
70-
if (index - padding) >= 0 {
68+
if index >= hidden_selection_count && (index - padding) >= 0 {
7169
let value = &fields_values[(index - padding) as usize];
7270
if value.as_any().downcast_ref::<SymbolExpression>().is_none() {
73-
let evaluated = evaluate_expression(env, value, titles, &values);
74-
values.push(evaluated.unwrap_or(Value::Null));
71+
let evaluated = evaluate_expression(env, value, titles, &values)?;
72+
values.push(evaluated);
7573
continue;
7674
}
7775
}
7876

77+
let field_name = &fields_names[index as usize];
78+
7979
if field_name == "path" {
8080
let file_path_string = path.to_str().unwrap_or("");
8181
values.push(Value::Text(file_path_string.to_string()));
@@ -125,10 +125,10 @@ impl DataProvider for FileDataProvider {
125125
}
126126

127127
groups.push(Group { rows });
128-
GitQLObject {
128+
Ok(GitQLObject {
129129
titles: titles.to_vec(),
130130
groups,
131-
}
131+
})
132132
}
133133
}
134134

0 commit comments

Comments
 (0)