@@ -8,6 +8,19 @@ pub struct ColumnDoc {
88 name : String ,
99 doc : Option < String > ,
1010}
11+ impl ColumnDoc {
12+ /// Getter for the `name` field
13+ #[ must_use]
14+ pub fn name ( & self ) -> & str {
15+ & self . name
16+ }
17+
18+ /// Getter for the field `doc`
19+ #[ must_use]
20+ pub fn doc ( & self ) -> & Option < String > {
21+ & self . doc
22+ }
23+ }
1124
1225/// Structure for containing the `name` of the `Table`, an [`Option`] for the
1326/// comment as a [`String`], and a `Vec` of [`ColumnDoc`] contained in the table
@@ -17,6 +30,27 @@ pub struct TableDoc {
1730 columns : Vec < ColumnDoc > ,
1831}
1932
33+ impl TableDoc {
34+
35+ /// Getter for the `name` field
36+ #[ must_use]
37+ pub fn name ( & self ) -> & str {
38+ & self . name
39+ }
40+
41+ /// Getter for the `doc` field
42+ #[ must_use]
43+ pub fn doc ( & self ) -> & Option < String > {
44+ & self . doc
45+ }
46+
47+ /// Getter for the `columns` field
48+ #[ must_use]
49+ pub fn columns ( & self ) -> & [ ColumnDoc ] {
50+ & self . columns
51+ }
52+ }
53+
2054/// Structure for containing the docs for every `Table` in an `.sql` file as a
2155/// `Vec` of [`TableDoc`]
2256pub struct SqlDocs {
@@ -26,11 +60,12 @@ pub struct SqlDocs {
2660impl SqlDocs {
2761 /// Create a new instance of [`SqlDocs`]
2862 #[ must_use]
29- pub fn new ( tables : Vec < TableDoc > ) -> Self {
63+ pub const fn new ( tables : Vec < TableDoc > ) -> Self {
3064 Self { tables }
3165 }
3266
33- /// Builds documentation for sql file by attaching leading comments to tables and columns
67+ /// Builds documentation for sql file by attaching leading comments to
68+ /// tables and columns
3469 #[ must_use]
3570 pub fn from_parsed_file ( file : & ParsedSqlFile , comments : & Comments ) -> Self {
3671 todo ! ( )
0 commit comments