SQLite parser

Latest Version Build Status

Usage

This crate will make it easy to parse a SQLite database. This can be useful for code generation.

Add a dependency on this crate by adding this line under [dependencies] in your Cargo.toml file:

sqlite_parser = "*"

Than implement the Parser trait and call the parse function with the implementing struct and the location of the SQLite file. There is a convenience method that doesn't require an implementing Parser trait called parse_no_parser.

Calling the parser

There are 2 ways of using this library - Implement the Parser trait and call the parse function. ``` use sqliteparser::{parse, Parser, Table}; use std::fs::File; use std::collections::hashmap::RandomState; use std::collections::HashMap;

/// This is the location to the SQLite file let mysqlitefilelocation = std::env::currentdir().unwrap().join("test_sqlite.sqlite3");

/// 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, tables: HashMap) { // Do something with the tables } }

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

/// Start the parsing let tables = parsenoparser(&mysqlitefile_location); /// Do stuff with the tables property! ```

What will it parse?