File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,19 +3,20 @@ use std::fs;
33use std:: io;
44use std:: path:: { Path , PathBuf } ;
55
6- pub struct SqlFiles {
6+ pub struct SqlFilesList {
77 sql_files : Vec < PathBuf > ,
88}
99
10- impl SqlFiles {
11- pub fn new < P : AsRef < Path > > ( path : P ) -> io:: Result < SqlFiles > {
10+ impl SqlFilesList {
11+ pub fn new < P : AsRef < Path > > ( path : P ) -> io:: Result < SqlFilesList > {
1212 let recursive_scan = recursive_dir_scan ( path. as_ref ( ) ) ?;
13- Ok ( SqlFiles {
13+ Ok ( SqlFilesList {
1414 sql_files : recursive_scan,
1515 } )
1616 }
1717}
1818
19+ /// Helper function to recursively scan the specified directory and collect all sql files found
1920fn recursive_dir_scan ( path : & Path ) -> io:: Result < Vec < PathBuf > > {
2021 let mut sql_files = Vec :: new ( ) ;
2122 for entry in fs:: read_dir ( path) ? {
@@ -31,15 +32,15 @@ fn recursive_dir_scan(path: &Path) -> io::Result<Vec<PathBuf>> {
3132 Ok ( sql_files)
3233}
3334
34- pub struct Content {
35- raw_sql : String ,
35+ pub struct SqlFile {
36+ path : PathBuf ,
37+ content : String ,
3638}
3739
38- // impl Content {
39- // pub fn new(files: SqlFiles) -> Content {
40+ pub struct SqlFileSet {
41+ files_contents : Vec < SqlFile >
42+ }
4043
41- // }
42- // }
4344
4445#[ cfg( test) ]
4546mod tests {
Original file line number Diff line number Diff line change 22use std:: fs;
33use std:: io;
44
5- mod files;
5+ pub mod files;
66
77fn main ( ) -> io:: Result < ( ) > {
88 let path = "/home/alex/Projects/sql-docs/sql_files/" ;
You can’t perform that action at this time.
0 commit comments