Skip to content

Commit 2bf380a

Browse files
committed
TableDoc will now sort ColumnDoc by name
1 parent f6bf815 commit 2bf380a

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/docs.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub struct TableDoc {
6868
}
6969

7070
impl TableDoc {
71-
/// Creates a new [`TableDoc`]
71+
/// Creates a new [`TableDoc`] after sorting [`ColumnDoc`] by name
7272
///
7373
/// # Parameters
7474
/// - name: `String` - the name of the table
@@ -80,9 +80,10 @@ impl TableDoc {
8080
schema: Option<String>,
8181
name: String,
8282
doc: Option<String>,
83-
columns: Vec<ColumnDoc>,
83+
mut columns: Vec<ColumnDoc>,
8484
path: Option<PathBuf>,
8585
) -> Self {
86+
columns.sort_by(|a,b| a.name().cmp(b.name()));
8687
Self { schema, name, doc, columns, path }
8788
}
8889

0 commit comments

Comments
 (0)