sq3-rs 0.2.13

SQLite reader with no dependencies
Documentation
use super::{
    abort::Abort, action::Action, add::Add, after::After, all::All, alter::Alter, always::Always,
    analyze::Analyze, and::And, as_::As, asc::Asc, attach::Attach, autoincrement::Autoincrement,
    before::Before, begin::Begin, between::Between, by::By, cascade::Cascade, case::Case,
    cast::Cast, check::Check, collate::Collate, column::Column, commit::Commit, conflict::Conflict,
    constraint::Constraint, create::Create, cross::Cross, current::Current,
    current_date::Current_date, current_time::Current_time, current_timestamp::Current_timestamp,
    database::Database, default::Default, deferrable::Deferrable, deferred::Deferred,
    delete::Delete, desc::Desc, detach::Detach, distinct::Distinct, do_::Do, drop::Drop,
    each::Each, else_::Else, end::End, escape::Escape, except::Except, exclude::Exclude,
    exclusive::Exclusive, exists::Exists, explain::Explain, fail::Fail, filter::Filter,
    first::First, following::Following, for_::For, foreign::Foreign, from::From as KeywordFrom,
    full::Full, generated::Generated, glob::Glob, group::Group, groups::Groups, having::Having,
    if_::If, ignore::Ignore, immediate::Immediate, in_::In, index::Index, indexed::Indexed,
    initially::Initially, inner::Inner, insert::Insert, instead::Instead, intersect::Intersect,
    into::Into, is::Is, isnull::Isnull, join::Join, key::Key, last::Last, left::Left, like::Like,
    limit::Limit, match_::Match, materialized::Materialized, natural::Natural, no::No, not::Not,
    nothing::Nothing, notnull::Notnull, null::Null, nulls::Nulls, of::Of, offset::Offset, on::On,
    or::Or, order::Order, others::Others, outer::Outer, over::Over, partition::Partition,
    plan::Plan, pragma::Pragma, preceding::Preceding, primary::Primary, query::Query, raise::Raise,
    range::Range, recursive::Recursive, references::References, regexp::Regexp, reindex::Reindex,
    release::Release, rename::Rename, replace::Replace, restrict::Restrict, returning::Returning,
    right::Right, rollback::Rollback, row::Row, rows::Rows, savepoint::Savepoint, select::Select,
    set::Set, table::Table, temp::Temp, temporary::Temporary, then::Then, ties::Ties, to::To,
    transaction::Transaction, trigger::Trigger, unbounded::Unbounded, union::Union, unique::Unique,
    update::Update, using::Using, vacuum::Vacuum, values::Values, view::View, virtual_::Virtual,
    when::When, where_::Where, window::Window, with::With, without::Without,
};

use crate::query::keyword::Keyword;

struct SqliteKeywords;

impl SqliteKeywords {
    fn all() -> Vec<&'static str> {
        vec![
            Abort::as_str(),
            Action::as_str(),
            Add::as_str(),
            After::as_str(),
            All::as_str(),
            Alter::as_str(),
            Always::as_str(),
            Analyze::as_str(),
            And::as_str(),
            As::as_str(),
            Asc::as_str(),
            Attach::as_str(),
            Autoincrement::as_str(),
            Before::as_str(),
            Begin::as_str(),
            Between::as_str(),
            By::as_str(),
            Cascade::as_str(),
            Case::as_str(),
            Cast::as_str(),
            Check::as_str(),
            Collate::as_str(),
            Column::as_str(),
            Commit::as_str(),
            Conflict::as_str(),
            Constraint::as_str(),
            Create::as_str(),
            Cross::as_str(),
            Current::as_str(),
            Current_date::as_str(),
            Current_time::as_str(),
            Current_timestamp::as_str(),
            Database::as_str(),
            Default::as_str(),
            Deferrable::as_str(),
            Deferred::as_str(),
            Delete::as_str(),
            Desc::as_str(),
            Detach::as_str(),
            Distinct::as_str(),
            Do::as_str(),
            Drop::as_str(),
            Each::as_str(),
            Else::as_str(),
            End::as_str(),
            Escape::as_str(),
            Except::as_str(),
            Exclude::as_str(),
            Exclusive::as_str(),
            Exists::as_str(),
            Explain::as_str(),
            Fail::as_str(),
            Filter::as_str(),
            First::as_str(),
            Following::as_str(),
            For::as_str(),
            Foreign::as_str(),
            KeywordFrom::as_str(),
            Full::as_str(),
            Generated::as_str(),
            Glob::as_str(),
            Group::as_str(),
            Groups::as_str(),
            Having::as_str(),
            If::as_str(),
            Ignore::as_str(),
            Immediate::as_str(),
            In::as_str(),
            Index::as_str(),
            Indexed::as_str(),
            Initially::as_str(),
            Inner::as_str(),
            Insert::as_str(),
            Instead::as_str(),
            Intersect::as_str(),
            Into::as_str(),
            Is::as_str(),
            Isnull::as_str(),
            Join::as_str(),
            Key::as_str(),
            Last::as_str(),
            Left::as_str(),
            Like::as_str(),
            Limit::as_str(),
            Match::as_str(),
            Materialized::as_str(),
            Natural::as_str(),
            No::as_str(),
            Not::as_str(),
            Nothing::as_str(),
            Notnull::as_str(),
            Null::as_str(),
            Nulls::as_str(),
            Of::as_str(),
            Offset::as_str(),
            On::as_str(),
            Or::as_str(),
            Order::as_str(),
            Others::as_str(),
            Outer::as_str(),
            Over::as_str(),
            Partition::as_str(),
            Plan::as_str(),
            Pragma::as_str(),
            Preceding::as_str(),
            Primary::as_str(),
            Query::as_str(),
            Raise::as_str(),
            Range::as_str(),
            Recursive::as_str(),
            References::as_str(),
            Regexp::as_str(),
            Reindex::as_str(),
            Release::as_str(),
            Rename::as_str(),
            Replace::as_str(),
            Restrict::as_str(),
            Returning::as_str(),
            Right::as_str(),
            Rollback::as_str(),
            Row::as_str(),
            Rows::as_str(),
            Savepoint::as_str(),
            Select::as_str(),
            Set::as_str(),
            Table::as_str(),
            Temp::as_str(),
            Temporary::as_str(),
            Then::as_str(),
            Ties::as_str(),
            To::as_str(),
            Transaction::as_str(),
            Trigger::as_str(),
            Unbounded::as_str(),
            Union::as_str(),
            Unique::as_str(),
            Update::as_str(),
            Using::as_str(),
            Vacuum::as_str(),
            Values::as_str(),
            View::as_str(),
            Virtual::as_str(),
            When::as_str(),
            Where::as_str(),
            Window::as_str(),
            With::as_str(),
            Without::as_str(),
        ]
    }
}

#[test]
fn ok_on_parse_all_keywords() {
    SqliteKeywords::all().iter().for_each(|s| {
        let parsed = s.parse::<Keyword>();
        assert!(parsed.is_ok());
    })
}

#[test]
fn err_on_parse_invalid_keyword() {
    let parsed = "BINARY".parse::<Keyword>();
    assert!(parsed.is_err());
}