Skip to content

Commit fd1f8b2

Browse files
committed
Simplify keysets to Option<Vec<String>>
1 parent 97181d1 commit fd1f8b2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

generator/src/dbscheme.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub enum Entry {
1111
pub struct Table {
1212
pub name: String,
1313
pub columns: Vec<Column>,
14-
pub keysets: Vec<Vec<String>>,
14+
pub keysets: Option<Vec<String>>,
1515
}
1616

1717
/// A column in a table.

generator/src/main.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ fn add_field(
107107
],
108108
// In addition to the field being unique, the combination of
109109
// parent+index is unique, so add a keyset for them.
110-
keysets: vec![vec![
110+
keysets: Some(vec![
111111
dbscheme::escape_name(parent_name),
112112
"index".to_string(),
113-
]],
113+
]),
114114
};
115115
entries.push(dbscheme::Entry::Table(field_table));
116116
} else {
@@ -159,7 +159,7 @@ fn convert_nodes(nodes: &[NodeInfo]) -> Vec<dbscheme::Entry> {
159159
ql_type: dbscheme::QlColumnType::Custom(dbscheme::escape_name(&name)),
160160
ql_type_is_ref: false,
161161
}],
162-
keysets: vec![],
162+
keysets: None,
163163
};
164164
top_members.push(dbscheme::escape_name(&name));
165165

@@ -232,7 +232,7 @@ fn write_dbscheme(entries: &[dbscheme::Entry]) -> std::io::Result<()> {
232232
fn create_location_entry() -> dbscheme::Entry {
233233
dbscheme::Entry::Table(dbscheme::Table {
234234
name: "location".to_string(),
235-
keysets: Vec::new(),
235+
keysets: None,
236236
columns: vec![
237237
dbscheme::Column {
238238
unique: true,
@@ -283,7 +283,7 @@ fn create_location_entry() -> dbscheme::Entry {
283283
fn create_source_location_prefix_entry() -> dbscheme::Entry {
284284
dbscheme::Entry::Table(dbscheme::Table {
285285
name: "sourceLocationPrefix".to_string(),
286-
keysets: Vec::new(),
286+
keysets: None,
287287
columns: vec![dbscheme::Column {
288288
unique: false,
289289
db_type: dbscheme::DbColumnType::String,

0 commit comments

Comments
 (0)