This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use thiserror::Error; | |
use std::{result}; | |
use sqlparser::parser::ParserError; | |
pub type Result<T> = result::Result<T, SQLRiteError>; | |
#[derive(Error, Debug, PartialEq)] | |
pub enum SQLRiteError { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use sqlparser::ast::{ColumnOption, DataType, ObjectName, Statement}; | |
use crate::error::{SQLRiteError, Result}; | |
// Represents Columns in a table | |
#[derive(PartialEq, Debug)] | |
pub struct ParsedColumn { | |
pub name: String, | |
pub datatype: String, | |
pub is_pk: bool, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mod parser; | |
pub mod tokenizer; | |
use parser::create::{CreateQuery}; | |
use sqlparser::ast::{Statement}; | |
use sqlparser::dialect::SQLiteDialect; | |
use sqlparser::parser::{Parser, ParserError}; | |
use crate::error::{SQLRiteError, Result}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use crate::error::{Result, SQLRiteError}; | |
use std::fmt; | |
#[derive(Debug, PartialEq)] | |
pub enum MetaCommand { | |
Exit, | |
Help, | |
Open(String), | |
Unknown, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate clap; | |
mod meta_command; | |
mod repl; | |
mod sql; | |
mod error; | |
use repl::{REPLHelper, get_config, get_command_type, CommandType}; | |
use meta_command::{handle_meta_command}; | |
use sql::{process_command}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./rust_sqlite | |
Rust-SQLite - 0.1.0 | |
Enter .exit to quit. | |
Enter .help for usage hints. | |
Connected to a transient in-memory database. | |
Use '.open FILENAME' to reopen on a persistent database. | |
rust-sqlite | 1> random command; | |
Error: unknown command or invalid arguments: 'random command;'. Enter '.help' | |
rust-sqlite | 2> .exit | |
$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::borrow::Cow::{self, Borrowed, Owned}; | |
use rustyline_derive::{Helper, Completer}; | |
use rustyline::error::ReadlineError; | |
use rustyline::config::OutputStreamType; | |
use rustyline::{CompletionType, Config, Context, EditMode}; | |
use rustyline::validate::{MatchingBracketValidator, Validator}; | |
use rustyline::validate::{ValidationContext, ValidationResult}; | |
use rustyline::hint::{Hinter, HistoryHinter}; | |
use rustyline::highlight::{Highlighter, MatchingBracketHighlighter}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate clap; | |
mod repl; | |
use repl::{REPLHelper, get_config}; | |
use rustyline::error::ReadlineError; | |
use rustyline::{Editor}; | |
use clap::{App, crate_version}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package gocontext | |
import ( | |
"context" | |
"net/http" | |
) | |
type SomeMiddleware interface { | |
HandleHTTPC(ctx context.Context, rw http.ResponseWriter, req *http.Request, next http.Handler) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package gocontext | |
import ( | |
"context" | |
"net/http" | |
) | |
type SomeMiddleware interface { | |
HandleHTTPC(ctx context.Context, rw http.ResponseWriter, req *http.Request, next http.Handler) | |
} |
NewerOlder