-
Notifications
You must be signed in to change notification settings - Fork 761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: replace String with Tenant #15119
Conversation
Replacing all String with Tenant introduces a lot changes. These changes will be split into several PRs. This is one of them. - Part of databendlabs#14719
@@ -3611,18 +3612,30 @@ pub fn create_database_option(i: Input) -> IResult<CreateDatabaseOption> { | |||
rule! { | |||
FROM ~ SHARE ~ #ident ~ "." ~ #ident | |||
}, | |||
|(_, _, tenant, _, share_name)| { | |||
|(_x, _y, tenant, _z, share_name)| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why xyz?
// TODO: non-safe new() that does not return an error | ||
tenant: Tenant::new(tenant.to_string()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use map_res
to return an error.
if let CreateDatabaseOption::FromShare(ident) = &opt { | ||
if ident.tenant.name().is_empty() { | ||
return Err(nom::Err::Error(Error::from_error_kind( | ||
i, | ||
ErrorKind::Other("tenant is empty string"), | ||
))); | ||
} | ||
} | ||
|
||
Ok((i, opt)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use map_res
instead.
@andylokandy |
I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/
Summary
refactor: replace String with Tenant
Replacing all String with Tenant introduces a lot changes.
These changes will be split into several PRs.
This is one of them.
Tests
Type of change
Related Issues
This change is