Skip to content

Commit c7d8f5b

Browse files
committed
store: Make Layout.table a little easier to use
1 parent 5820151 commit c7d8f5b

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

store/postgres/src/relational.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -442,12 +442,13 @@ impl Layout {
442442
Ok(())
443443
}
444444

445-
/// Find the table with the provided `name`. The name must exactly match
446-
/// the name of an existing table. No conversions of the name are done
447-
pub fn table(&self, name: &SqlName) -> Option<&Table> {
445+
/// Find the table with the provided `sql_name`. The name must exactly
446+
/// match the name of an existing table. No conversions of the name are
447+
/// done
448+
pub fn table(&self, sql_name: &str) -> Option<&Table> {
448449
self.tables
449450
.values()
450-
.find(|table| &table.name == name)
451+
.find(|table| &table.name == sql_name)
451452
.map(|rc| rc.as_ref())
452453
}
453454

store/postgres/src/relational/ddl_tests.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ fn test_layout(gql: &str) -> Layout {
2626
#[test]
2727
fn table_is_sane() {
2828
let layout = test_layout(THING_GQL);
29-
let table = layout
30-
.table(&"thing".into())
31-
.expect("failed to get 'thing' table");
29+
let table = layout.table("thing").expect("failed to get 'thing' table");
3230
assert_eq!(SqlName::from("thing"), table.name);
3331
assert_eq!("Thing", table.object.as_str());
3432

0 commit comments

Comments
 (0)