Export symbols and string helpers from mentat_query_algebrizer.

This commit is contained in:
Richard Newman 2017-02-16 15:38:53 -08:00
parent f890995202
commit a9cd9b1e87
2 changed files with 30 additions and 3 deletions

View file

@ -47,7 +47,7 @@ pub enum DatomsTable {
}
impl DatomsTable {
fn name(&self) -> &'static str {
pub fn name(&self) -> &'static str {
match *self {
DatomsTable::Datoms => "datoms",
DatomsTable::FulltextValues => "fulltext_values",
@ -67,16 +67,30 @@ pub enum DatomsColumn {
ValueTypeTag,
}
impl DatomsColumn {
pub fn as_str(&self) -> &'static str {
use DatomsColumn::*;
match *self {
Entity => "e",
Attribute => "a",
Value => "v",
Tx => "tx",
ValueTypeTag => "value_type_tag",
}
}
}
/// A specific instance of a table within a query. E.g., "datoms123".
pub type TableAlias = String;
/// The association between a table and its alias. E.g., AllDatoms, "all_datoms123".
#[derive(PartialEq, Eq, Debug)]
pub struct SourceAlias(DatomsTable, TableAlias);
pub struct SourceAlias(pub DatomsTable, pub TableAlias);
/// A particular column of a particular aliased table. E.g., "datoms123", Attribute.
#[derive(PartialEq, Eq, Clone, Debug)]
pub struct QualifiedAlias(TableAlias, DatomsColumn);
pub struct QualifiedAlias(pub TableAlias, pub DatomsColumn);
impl QualifiedAlias {
fn for_type_tag(&self) -> QualifiedAlias {

View file

@ -37,3 +37,16 @@ pub fn algebrize(parsed: FindQuery) -> AlgebraicQuery {
cc: cc::ConjoiningClauses::default(),
}
}
pub use cc::{
ConjoiningClauses,
};
pub use cc::{
DatomsColumn,
DatomsTable,
QualifiedAlias,
SourceAlias,
TableAlias,
};