Export symbols and string helpers from mentat_query_algebrizer.
This commit is contained in:
parent
f890995202
commit
a9cd9b1e87
2 changed files with 30 additions and 3 deletions
|
@ -47,7 +47,7 @@ pub enum DatomsTable {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DatomsTable {
|
impl DatomsTable {
|
||||||
fn name(&self) -> &'static str {
|
pub fn name(&self) -> &'static str {
|
||||||
match *self {
|
match *self {
|
||||||
DatomsTable::Datoms => "datoms",
|
DatomsTable::Datoms => "datoms",
|
||||||
DatomsTable::FulltextValues => "fulltext_values",
|
DatomsTable::FulltextValues => "fulltext_values",
|
||||||
|
@ -67,16 +67,30 @@ pub enum DatomsColumn {
|
||||||
ValueTypeTag,
|
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".
|
/// A specific instance of a table within a query. E.g., "datoms123".
|
||||||
pub type TableAlias = String;
|
pub type TableAlias = String;
|
||||||
|
|
||||||
/// The association between a table and its alias. E.g., AllDatoms, "all_datoms123".
|
/// The association between a table and its alias. E.g., AllDatoms, "all_datoms123".
|
||||||
#[derive(PartialEq, Eq, Debug)]
|
#[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.
|
/// A particular column of a particular aliased table. E.g., "datoms123", Attribute.
|
||||||
#[derive(PartialEq, Eq, Clone, Debug)]
|
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||||
pub struct QualifiedAlias(TableAlias, DatomsColumn);
|
pub struct QualifiedAlias(pub TableAlias, pub DatomsColumn);
|
||||||
|
|
||||||
impl QualifiedAlias {
|
impl QualifiedAlias {
|
||||||
fn for_type_tag(&self) -> QualifiedAlias {
|
fn for_type_tag(&self) -> QualifiedAlias {
|
||||||
|
|
|
@ -37,3 +37,16 @@ pub fn algebrize(parsed: FindQuery) -> AlgebraicQuery {
|
||||||
cc: cc::ConjoiningClauses::default(),
|
cc: cc::ConjoiningClauses::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub use cc::{
|
||||||
|
ConjoiningClauses,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub use cc::{
|
||||||
|
DatomsColumn,
|
||||||
|
DatomsTable,
|
||||||
|
QualifiedAlias,
|
||||||
|
SourceAlias,
|
||||||
|
TableAlias,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue