|
8 | 8 | // by the Apache License, Version 2.0.
|
9 | 9 |
|
10 | 10 | use std::convert::{AsRef, TryFrom};
|
| 11 | +use std::hash::Hash; |
11 | 12 | use std::sync::Arc;
|
12 | 13 | use std::{cmp, fmt, ops};
|
13 | 14 |
|
@@ -104,7 +105,7 @@ macro_rules! impl_serde {
|
104 | 105 | }
|
105 | 106 |
|
106 | 107 | pub(crate) use impl_serde;
|
107 |
| -use like::Like; |
| 108 | +use like::ILike; |
108 | 109 |
|
109 | 110 | ////////////////////////////////////////////////////////////////////////////////
|
110 | 111 |
|
@@ -233,7 +234,7 @@ newtype_str!(
|
233 | 234 |
|
234 | 235 | impl DatasetNamePattern {
|
235 | 236 | pub fn matches(&self, dataset_name: &DatasetName) -> bool {
|
236 |
| - Like::<false>::like(dataset_name.as_str(), self).unwrap() |
| 237 | + ILike::<false>::ilike(dataset_name.as_str(), self).unwrap() |
237 | 238 | }
|
238 | 239 | }
|
239 | 240 |
|
@@ -311,7 +312,7 @@ newtype_str!(RepoName, Grammar::match_repo_name, RepoNameSerdeVisitor);
|
311 | 312 |
|
312 | 313 | ////////////////////////////////////////////////////////////////////////////////
|
313 | 314 |
|
314 |
| -#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] |
| 315 | +#[derive(Debug, Clone, Eq, PartialOrd, Ord)] |
315 | 316 | pub struct DatasetAlias {
|
316 | 317 | pub account_name: Option<AccountName>,
|
317 | 318 | pub dataset_name: DatasetName,
|
@@ -358,6 +359,23 @@ impl DatasetAlias {
|
358 | 359 | }
|
359 | 360 | }
|
360 | 361 |
|
| 362 | +impl PartialEq<Self> for DatasetAlias { |
| 363 | + fn eq(&self, other: &Self) -> bool { |
| 364 | + (self.account_name.is_some() |
| 365 | + && other.account_name.is_some() |
| 366 | + && self.account_name.as_ref().unwrap().to_lowercase() |
| 367 | + == other.account_name.as_ref().unwrap().to_lowercase()) |
| 368 | + && self.dataset_name.to_lowercase() == other.dataset_name.to_lowercase() |
| 369 | + } |
| 370 | +} |
| 371 | + |
| 372 | +impl Hash for DatasetAlias { |
| 373 | + fn hash<H: std::hash::Hasher>(&self, state: &mut H) { |
| 374 | + self.account_name.hash(state); |
| 375 | + self.dataset_name.hash(state); |
| 376 | + } |
| 377 | +} |
| 378 | + |
361 | 379 | impl std::str::FromStr for DatasetAlias {
|
362 | 380 | type Err = ParseError<Self>;
|
363 | 381 | fn from_str(s: &str) -> Result<Self, Self::Err> {
|
@@ -388,7 +406,7 @@ impl_serde!(DatasetAlias, DatasetAliasSerdeVisitor);
|
388 | 406 |
|
389 | 407 | ////////////////////////////////////////////////////////////////////////////////
|
390 | 408 |
|
391 |
| -#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] |
| 409 | +#[derive(Debug, Clone, Eq, PartialOrd, Ord)] |
392 | 410 | pub struct DatasetAliasRemote {
|
393 | 411 | pub repo_name: RepoName,
|
394 | 412 | pub account_name: Option<AccountName>,
|
@@ -437,6 +455,25 @@ impl DatasetAliasRemote {
|
437 | 455 | }
|
438 | 456 | }
|
439 | 457 |
|
| 458 | +impl PartialEq<Self> for DatasetAliasRemote { |
| 459 | + fn eq(&self, other: &Self) -> bool { |
| 460 | + (self.repo_name.to_lowercase() == other.repo_name.to_lowercase()) |
| 461 | + && (self.account_name.is_some() |
| 462 | + && other.account_name.is_some() |
| 463 | + && self.account_name.as_ref().unwrap().to_lowercase() |
| 464 | + == other.account_name.as_ref().unwrap().to_lowercase()) |
| 465 | + && self.dataset_name.to_lowercase() == other.dataset_name.to_lowercase() |
| 466 | + } |
| 467 | +} |
| 468 | + |
| 469 | +impl Hash for DatasetAliasRemote { |
| 470 | + fn hash<H: std::hash::Hasher>(&self, state: &mut H) { |
| 471 | + self.repo_name.hash(state); |
| 472 | + self.account_name.hash(state); |
| 473 | + self.dataset_name.hash(state); |
| 474 | + } |
| 475 | +} |
| 476 | + |
440 | 477 | impl std::str::FromStr for DatasetAliasRemote {
|
441 | 478 | type Err = ParseError<Self>;
|
442 | 479 | fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
0 commit comments