[][src]Function sqlite_parser::parse

pub fn parse<P: AsRef<Path>, Parse: Parser>(path: P, parser: &mut Parse)

The method to call to start parsing the SQLite file Example:

use sqlite_parser::{parse, Parser, Table, Metadata};
use std::fs::File;

/// This is the location to the SQLite file
let my_sqlite_file_location = std::env::current_dir().unwrap().join("test_sqlite.sqlite3");
/// For the doc test, create the actual SQLite file
let sqlite_file = File::create(&my_sqlite_file_location).unwrap();

/// Create a parse struct to process the tables
/// Note: there is a convenience method `parse_no_parser` that doesn't require a parser.
struct Parse;

impl Parser for Parse {
    fn process_tables(&mut self, meta_data: Metadata) {
        // Do something with the tables
    }
}

/// Start the parsing
parse(&my_sqlite_file_location, &mut Parse { });

/// Remove the SQLite file for the doc test
std::fs::remove_file(&my_sqlite_file_location).unwrap();