Skip to content

Commit

Permalink
merge with main
Browse files Browse the repository at this point in the history
  • Loading branch information
victoria de sainte agathe committed Dec 8, 2023
1 parent 1169cdf commit f86a420
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions src/privacy_unit_tracking/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,13 @@ impl Relation {
pub fn privacy_unit_row(self) -> Self {
let expr = Expr::random(namer::new_id(self.name()));
self.identity_with_field(
PrivacyUnit::per_row_privacy(),
PrivacyUnit::privacy_unit_row(),
expr,
)
}
/// Add the field containing the privacy unit
pub fn add_privacy_unit(self, referred_field: &str) -> Self {
let relation = if referred_field == PrivacyUnit::per_row_privacy() {
let relation = if referred_field == PrivacyUnit::privacy_unit_row() {
self.privacy_unit_row()
} else {
self
Expand All @@ -164,7 +164,7 @@ impl Relation {
.map(|f| f.name().to_string())
.filter(|name| name != &referred_field_name)
.collect();
let referred_relation = if referred_field == PrivacyUnit::per_row_privacy() {
let referred_relation = if referred_field == PrivacyUnit::privacy_unit_row() {
Arc::new(
referred_relation.deref()
.clone()
Expand Down Expand Up @@ -596,7 +596,7 @@ mod tests {
let orders = relations.get(&["orders".to_string()]).unwrap().as_ref();
let relation = orders.clone().with_field_path(
&relations,
PrivacyUnitPath::from((vec![("user_id", "users", "id")], PrivacyUnit::per_row_privacy())),
PrivacyUnitPath::from((vec![("user_id", "users", "id")], PrivacyUnit::privacy_unit_row())),
);
relation.display_dot().unwrap();
assert!(relation.schema()[0].name() == PrivacyUnit::privacy_unit());
Expand All @@ -606,7 +606,7 @@ mod tests {
&relations,
PrivacyUnitPath::from((
vec![("order_id", "orders", "id"), ("user_id", "users", "id")],
PrivacyUnit::per_row_privacy(),
PrivacyUnit::privacy_unit_row(),
)),
);
relation.display_dot().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/privacy_unit_tracking/privacy_unit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ impl PrivacyUnit {
PRIVACY_COLUMNS
}

pub fn per_row_privacy() -> &'static str {
pub fn privacy_unit_row() -> &'static str {
PRIVACY_UNIT_ROW
}

Expand Down
12 changes: 6 additions & 6 deletions src/rewriting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,10 @@ mod tests {
("order_id", "order_table", "id"),
("user_id", "user_table", "id"),
],
PrivacyUnit::per_row_privacy(),
PrivacyUnit::privacy_unit_row(),
),
("order_table", vec![("user_id", "user_table", "id")], PrivacyUnit::per_row_privacy()),
("user_table", vec![], PrivacyUnit::per_row_privacy()),
("order_table", vec![("user_id", "user_table", "id")], PrivacyUnit::privacy_unit_row()),
("user_table", vec![], PrivacyUnit::privacy_unit_row()),
]);
let budget = Budget::new(1., 1e-3);
let relation = Relation::try_from(query.with(&relations)).unwrap();
Expand Down Expand Up @@ -285,10 +285,10 @@ mod tests {
("order_id", "order_table", "id"),
("user_id", "user_table", "id"),
],
PrivacyUnit::per_row_privacy(),
PrivacyUnit::privacy_unit_row(),
),
("order_table", vec![("user_id", "user_table", "id")], PrivacyUnit::per_row_privacy()),
("user_table", vec![], PrivacyUnit::per_row_privacy()),
("order_table", vec![("user_id", "user_table", "id")], PrivacyUnit::privacy_unit_row()),
("user_table", vec![], PrivacyUnit::privacy_unit_row()),
]);
let budget = Budget::new(1., 1e-3);
let relation = Relation::try_from(query.with(&relations)).unwrap();
Expand Down

0 comments on commit f86a420

Please sign in to comment.