Skip to content

Commit d3ff34d

Browse files
committed
store: More finegrained Diesel helpers
1 parent 8c8dbb4 commit d3ff34d

File tree

4 files changed

+574
-683
lines changed

4 files changed

+574
-683
lines changed

store/postgres/src/block_range.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -280,14 +280,6 @@ impl<'a> BlockRangeColumn<'a> {
280280
}
281281
}
282282

283-
/// Output the name of the block range column without the table prefix
284-
pub(crate) fn bare_name(&self, out: &mut AstPass<Pg>) {
285-
match self {
286-
BlockRangeColumn::Mutable { .. } => out.push_sql(BLOCK_RANGE_COLUMN),
287-
BlockRangeColumn::Immutable { .. } => out.push_sql(BLOCK_COLUMN),
288-
}
289-
}
290-
291283
/// Output an expression that matches all rows that have been changed
292284
/// after `block` (inclusive)
293285
pub(crate) fn changed_since<'b>(&'b self, out: &mut AstPass<'_, 'b, Pg>) -> QueryResult<()> {

store/postgres/src/relational/dsl.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,26 @@ impl<'a> Column<'a> {
693693
pub fn name(&self) -> &'a str {
694694
&self.column.name
695695
}
696+
697+
pub(crate) fn is_list(&self) -> bool {
698+
self.column.is_list()
699+
}
700+
701+
pub(crate) fn is_primary_key(&self) -> bool {
702+
self.column.is_primary_key()
703+
}
704+
705+
pub(crate) fn is_fulltext(&self) -> bool {
706+
self.column.is_fulltext()
707+
}
708+
709+
pub(crate) fn column_type(&self) -> &'a ColumnType {
710+
&self.column.column_type
711+
}
712+
713+
pub(crate) fn use_prefix_comparison(&self) -> bool {
714+
self.column.use_prefix_comparison
715+
}
696716
}
697717

698718
impl std::fmt::Display for Column<'_> {

store/postgres/src/relational/query_tests.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ fn filter_contains(filter: EntityFilter, sql: &str) {
4949
let layout = test_layout(SCHEMA);
5050
let table = layout
5151
.table_for_entity(&layout.input_schema.entity_type("Thing").unwrap())
52-
.unwrap();
53-
let filter = Filter::main(&layout, table.as_ref(), &filter, Default::default()).unwrap();
52+
.unwrap()
53+
.dsl_table();
54+
let filter = Filter::main(&layout, table, &filter, Default::default()).unwrap();
5455
let query = debug_query::<Pg, _>(&filter);
5556
assert!(
5657
query.to_string().contains(sql),

0 commit comments

Comments
 (0)